当前位置: 首页>>代码示例>>C#>>正文


C# Session.Dispose方法代码示例

本文整理汇总了C#中Session.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Session.Dispose方法的具体用法?C# Session.Dispose怎么用?C# Session.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session.Dispose方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Save

        public IEnumerable<DieModel> Save(DieModel data, SessionInfo epiSession)
        {
            try
            {
                Session currSession = new Session(epiSession.UserID, epiSession.UserPassword, epiSession.AppServer, Session.LicenseType.Default);
                UD107 myUD107 = new UD107(currSession.ConnectionPool);
                UD107DataSet dsUD107 = new UD107DataSet();

                string whereClause = string.Format(@"UD107.Key1 ='{0}' AND UD107.Key5 = '{1}'", data.DieCode, epiSession.PlantID);
                bool morePages = false;
                bool dataExisting = false;

                try
                {
                    UD107DataSet ds = myUD107.GetByID(data.DieCode, "", "", "", epiSession.PlantID);
                    dataExisting = true;
                }
                catch (Exception ex)
                {
                    if (ex.Message == "Record not found.") dataExisting = false;
                }

                if (dataExisting)
                {
                    dsUD107 = myUD107.GetRows(whereClause, "", "", 0, 1, out morePages);
                }
                else
                {
                    myUD107.GetaNewUD107(dsUD107);
                }

                DataRow drUD107 = dsUD107.Tables[0].Rows[0];
                drUD107.BeginEdit();
                drUD107["Key1"] = data.DieCode;
                drUD107["Key5"] = epiSession.PlantID;
                drUD107["Character01"] = data.DieName;
                drUD107["Character02"] = string.IsNullOrEmpty(data.DieRemark) ? "" : data.DieRemark;
                drUD107["ShortChar01"] = string.IsNullOrEmpty(data.PatternID) ? "" : data.PatternID;
                drUD107.EndEdit();
                myUD107.Update(dsUD107);
                currSession.Dispose();
                return GetDieAll(epiSession.PlantID);
            }
            catch (Exception ex)
            {
                return null;
            }
        }
开发者ID:swankham,项目名称:Epicoil,代码行数:48,代码来源:DieMasterRepo.cs

示例2: SessionIdentify

        public SessionInfo SessionIdentify(string userName, string userPassword, string culture = "en")
        {
            try
            {
                //Get AppServer URL from App.config file.
                AppServerURL = ConfigurationManager.ConnectionStrings["EpicorAppServer"].ConnectionString;
                Epicor.Mfg.Core.Session curr = new Session(userName, userPassword, AppServerURL, Session.LicenseType.Default);
                //curr.FormatCultureName
                if (curr.IsValidSession(curr.SessionID, curr.UserID))
                {
                    epiSession.AppServer = AppServerURL;
                    epiSession.CompanyID = curr.CompanyID;
                    epiSession.CompanyName = curr.CompanyName;
                    epiSession.PlantID = curr.PlantID;
                    epiSession.PlantName = curr.PlantName;
                    epiSession.UserID = curr.UserID;
                    epiSession.UserName = curr.UserName;
                    epiSession.SessionID = curr.SessionID;
                    epiSession.UserEmail = curr.UserEmail;
                    epiSession.Client = curr.Client.ToString();
                    epiSession.UserPassword = userPassword;
                    epiSession.Culture = culture;

                    curr.Dispose();
                    return epiSession;
                }
                else
                {
                    MessageBox.Show("Error: Get session from Epicor is invalid." + Environment.NewLine + "Please contact administrator.", "Error", MessageBoxButtons.OK);
                    epiSession.SessionID = "x";
                    return epiSession;
                }
            }
            catch (Exception ex)
            {
                epiSession.SessionID = "x";
                MessageBox.Show("Error: " + ex.Message + Environment.NewLine + "Please contact administrator.", "Error", MessageBoxButtons.OK);
                return epiSession;
            }
        }
开发者ID:swankham,项目名称:Epicoil,代码行数:40,代码来源:BaseSession.cs

示例3: DisposeShouldNotThrowExceptionWhenSocketIsNotConnected

        public void DisposeShouldNotThrowExceptionWhenSocketIsNotConnected()
        {
            var connectionInfo = new ConnectionInfo("localhost", 6767, Resources.USERNAME,
                new KeyboardInteractiveAuthenticationMethod(Resources.USERNAME));
            var session = new Session(connectionInfo, _serviceFactoryMock.Object);

            try
            {
                session.Connect();
                Assert.Fail();
            }
            catch (SocketException)
            {
                session.Dispose();
            }
        }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:16,代码来源:SessionTest.cs

示例4: AddPrimaryKeys

        public static void AddPrimaryKeys(Assembly assembly, string fromSchema, Session session)
        {
//            Type[] types = ReflectorHelper.GetTypes(typeof (DBObject), assembly);
//            ReflectorHelper.FilterTypes(ref types, true);
            XPClassInfo[] xpClassInfos = session.Dictionary.CollectClassInfos(new[] {assembly});
            foreach (XPClassInfo xpClassInfo in xpClassInfos)
            {
                Type type = xpClassInfo.ClassType;
                string tableName = type.Name;
                Attribute attribute = ReflectorHelper.GetAttribute(type, typeof (MapToAttribute));
                if (attribute != null)
                    tableName = ((MapToAttribute) attribute).MappingName;
                try
                {
//                    DBHelper.TransferToShema(session.DataLayer.CreateCommand(), fromSchema, tableName);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
                addPrimaryKey(session.DataLayer.CreateCommand(), tableName);
            }
            try
            {
//                DBHelper.TransferToShema(session.DataLayer.CreateCommand(), fromSchema, "XPObjectType");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            addPrimaryKey(session.DataLayer.CreateCommand(), "XPObjectType", "OID");
            session.Dispose();
        }
开发者ID:aries544,项目名称:eXpand,代码行数:33,代码来源:DBObject.cs

示例5: UpdatePOReleaseQty

        public bool UpdatePOReleaseQty(Session epiSession, string poNum, out string msgError)
        {
            msgError = "";
            bool result = false;

            if (epiSession.IsValidSession(epiSession.SessionID, epiSession.UserID))
            {
                try
                {
                    PO myPO = new PO(epiSession.ConnectionPool);

                    bool morePages = false;
                    PODataSet dsPO = new PODataSet();
                    dsPO = myPO.GetRows("PONum = " + poNum, "", "", "", "", "", "", "", "", 0, 1, out morePages);

                    DataRow drPO = dsPO.Tables["POHeader"].Select().Single();
                    string cal = drPO["ShortChar06"].ToString();

                    DataTable POLine = dsPO.Tables["PODetail"];
                    int i = 0;

                    foreach (DataRow list in dsPO.Tables["PORel"].Rows)
                    {
                        var item = POLine.Rows[i].ItemArray.ToArray();
                        decimal qty = 0;

                        if (cal == "1" || cal == "3" || cal == "4") { qty = Convert.ToDecimal(item[67].ToString()); }       //67=Number11, 
                        else if (cal == "2") { qty = Convert.ToDecimal(item[76].ToString()); }      //76=Number20

                        list.BeginEdit();
                        list["XRelQty"] = qty;
                        list["RelQty"] = qty;
                        list["BaseQty"] = qty;
                        list.EndEdit();
                        i++;
                    }

                    myPO.Update(dsPO);
                    result = true;
                    epiSession.Dispose();
                }
                catch (Exception ex)
                {
                    msgError = "Error : " + ex;                
                }
            }
            return result;
        }
开发者ID:swankham,项目名称:Epicoil,代码行数:48,代码来源:StoreInRepo.cs

示例6: FindOrCreateSG

		private StructureGroup FindOrCreateSG(Engine engine, string sgWebDav) {
			log.Debug(string.Format("Find or Create SG '{0}'", sgWebDav));

			StructureGroup sg = engine.GetObject(sgWebDav) as StructureGroup;
			if (sg == null) {
				int lastSlash = sgWebDav.LastIndexOf("/");
				string parentSGWebDav = sgWebDav.Substring(0, lastSlash);
				StructureGroup parentSG = FindOrCreateSG(engine, parentSGWebDav);
				Session newSession = new Session(engine.GetSession().User.Title);
				sg = new StructureGroup(newSession, parentSG.Id);

				string title = sgWebDav.Substring(lastSlash + 1);
				sg.Title = MakeSafeSGTitle(title);
				sg.Directory = MakeSafeDirectory(title);
				sg.Save();
				newSession.Dispose();

				log.Debug(string.Format("Created SG '{0}'", sgWebDav));
			} else {
				log.Debug(string.Format("Found SG '{0}'", sgWebDav));
			}

			return sg;
		}
开发者ID:amarildopps,项目名称:yet-another-tridion-blog,代码行数:24,代码来源:Utilities.cs

示例7: NewPart

        public string NewPart(NewPartModel model, SessionInfo epiSession, int StoreInNo, out bool IsSucces, out string msgError)
        {
            int iRunning = RunningPart();
            string PartNum = GetSerialByFormat(iRunning);
            try
            {
                Session currSession = new Session(epiSession.UserID, epiSession.UserPassword, epiSession.AppServer, Session.LicenseType.Default);
                Part myPart = new Part(currSession.ConnectionPool);
                
                PartDataSet dsPart = new PartDataSet();
                myPart.GetNewPart(dsPart);

                DataRow drPart = dsPart.Tables[0].Rows[0];
                drPart.BeginEdit();
                drPart["PartNum"] = PartNum;
                drPart["PartDescription"] = PartNum;
                drPart["UOMClassID"] = "COUNT";
                drPart["IUM"] = "KG";
                drPart["PUM"] = "KG";
                drPart["TypeCode"] = "M";
                drPart["SalesUM"] = "KG";
                drPart["UserChar4"] = model.SupplierCode;
                drPart["UnitPrice"] = model.Amount;
                drPart["Character01"] = model.SaleContract;
                drPart["Character03"] = model.NGRemark;
                drPart["Character07"] = model.ArticleNo;
                drPart["Character07"] = model.CustID;
                drPart["Number10"] = model.Quantity;
                drPart["Date01"] = DateTime.Now;

                drPart["ShortChar01"] = string.IsNullOrEmpty(model.CommodityCode) ? "" : model.CommodityCode;
                drPart["ShortChar02"] = string.IsNullOrEmpty(model.SpecCode) ? "" : model.SpecCode;
                drPart["ShortChar04"] = model.BussinessType;

                drPart["ShortChar05"] = model.MakerCode;
                drPart["ShortChar06"] = model.MillCode;
                drPart["Character07"] = model.ArticleNo;
                drPart["ShortChar08"] = iRunning;
                drPart["ShortChar09"] = model.CoatingCode;

                drPart["Number01"] = model.Thick;
                drPart["Number02"] = model.Width;
                drPart["Number03"] = model.Length;
                drPart["Number11"] = 1;
                drPart["Number12"] = 1;
                if (model.NGStatus == 1)
                {
                    drPart["Character10"] = "N";
                }
                else
                {
                    drPart["Character10"] = "B";
                }

                drPart["NetWeight"] = model.Weight;
                drPart.EndEdit();
                myPart.Update(dsPart);

                currSession.Dispose();

                UpdateStock(PartNum, model.Quantity);
                IsSucces = true;
                msgError = "";
            }
            catch (Exception ex)
            {
                IsSucces = false;
                msgError = ex.Message;
            }
            return PartNum;
        }
开发者ID:swankham,项目名称:Epicoil,代码行数:71,代码来源:StoreInRepo.cs

示例8: NewPart

        public bool NewPart(SessionInfo _session, ProductsMasterModel model, out bool IsSucces, out string msgError)
        {
            //int iRunning = RunningPart();
            //string PartNum = GetSerialByFormat(iRunning);
            try
            {
                ///TODO: Fix Epicor AppServer to workaround.
                Session currSession = new Session(_session.UserID, _session.UserPassword, _session.AppServer, Session.LicenseType.Default);
                Part myPart = new Part(currSession.ConnectionPool);

                PartDataSet dsPart = new PartDataSet();
                myPart.GetNewPart(dsPart);

                DataRow drPart = dsPart.Tables[0].Rows[0];
                drPart.BeginEdit();
                drPart["PartNum"] = model.NorNum;
                drPart["PartDescription"] = model.NorNum;
                drPart["UOMClassID"] = "UCC";
                drPart["IUM"] = (model.SizeLength > 0) ? "PCS" : "KG";  //Our UOM
                drPart["PUM"] = (model.SizeLength > 0) ? "PCS" : "KG"; ;   //Purchasing UOM
                drPart["TypeCode"] = "M";
                drPart["SalesUM"] = (model.SizeLength > 0) ? "PCS" : "KG"; ;   //Sale UOM
                drPart["ShortChar05"] = "M";
                drPart["Number01"] = model.SizeThick;
                drPart["Number02"] = model.SizeWidth;
                drPart["Number03"] = model.SizeLength;
                drPart["Number11"] = 1;
                drPart["Number12"] = 1;
                drPart["Character10"] = "N";

                drPart["NetWeight"] = model.CoilWeigthMin;
                drPart.EndEdit();
                myPart.Update(dsPart);

                currSession.Dispose();

                IsSucces = true;
                msgError = "";
            }
            catch (Exception ex)
            {
                IsSucces = false;
                msgError = ex.Message;
                return false;
            }
            return true;
        }
开发者ID:swankham,项目名称:Epicoil,代码行数:47,代码来源:ProductMasterRepo.cs

示例9: GetNewPart

        public bool GetNewPart(MCSS model, Models.SessionInfo epiSession, out bool IsSucces, out string msgError)
        {
            try
            {
                Session currSession = new Session(epiSession.UserID, epiSession.UserPassword, epiSession.AppServer, Session.LicenseType.Default);
                Part myPart = new Part(currSession.ConnectionPool);

                bool partExst = false;
                string whereClausePart = string.Format(@"Part.PartNum='{0}'", model.McssNum);
                //whereClausePart.Replace("=\"","");
                PartDataSet dsPart = new PartDataSet();
                if (myPart.PartExists(model.McssNum))
                {
                    dsPart = myPart.GetRows(whereClausePart, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, 1, out partExst);
                }
                else
                {
                    myPart.GetNewPart(dsPart);
                }
               
                DataRow drPart = dsPart.Tables[0].Rows[0];
                drPart.BeginEdit();
                drPart["PartNum"] = model.McssNum;
                drPart["PartDescription"] = model.McssNum;
                drPart["UOMClassID"] = "UCC";
                drPart["TypeCode"] = "P";
                drPart["IUM"] = (model.Length > 0) ? "PCS" : "KG";  //Our UOM
                drPart["PUM"] = (model.Length > 0) ? "PCS" : "KG"; ;   //Purchasing UOM
                drPart["TypeCode"] = "M";
                drPart["SalesUM"] = (model.Length > 0) ? "PCS" : "KG"; ;   //Sale UOM
                drPart["Character02"] = "";  //NCR No.
                drPart["Character08"] = string.IsNullOrEmpty(model.CustID) ? "" : model.CustID;
                drPart["Character10"] = ""; //Pack No.
                drPart["ShortChar01"] = string.IsNullOrEmpty(model.CommodityCode) ? "" : model.CommodityCode;
                drPart["ShortChar02"] = string.IsNullOrEmpty(model.MatSpec1) ? "" : model.MatSpec1;
                drPart["ShortChar07"] = "";  //Old Stock No.
                drPart["ShortChar09"] = string.IsNullOrEmpty(model.Coating1) ? "" : model.Coating1;
                drPart["ShortChar10"] = "6";  //PartStatus = MCSS
                drPart["Number01"] = model.Thick;
                drPart["Number02"] = model.Width;
                drPart["Number03"] = model.Length;
                drPart["TrackLots"] = 1;
                drPart["Number11"] = 1;
                drPart["Number12"] = model.Pocession.GetInt();
                drPart["Character10"] = "N";

                drPart["NetWeight"] = model.WeightPerCoilMin.GetDecimal();
                drPart.EndEdit();

                myPart.Update(dsPart);

                currSession.Dispose();

                IsSucces = true;
                msgError = "";
            }
            catch (Exception ex)
            {
                IsSucces = false;
                msgError = ex.Message;
            }
            return IsSucces;
        }
开发者ID:swankham,项目名称:Epicoil,代码行数:63,代码来源:McssRepo.cs

示例10: SaveUD34


//.........这里部分代码省略.........
                {
                    UD34DataSet ds = myUD34.GetByID(model.McssNum, "", "", "", epiSession.PlantID);
                    dataExisting = true;
                }
                catch (Exception ex)
                {
                    if (ex.Message == "Record not found.") dataExisting = false;
                }

                if (dataExisting)
                {
                    dsUD34 = myUD34.GetRows(whereClause, "", 0, 1, out morePages);
                }
                else
                {
                    myUD34.GetaNewUD34(dsUD34);
                }

                DataRow drUD34 = dsUD34.Tables[0].Rows[0];
                drUD34.BeginEdit();
                drUD34["Key1"] = model.McssNum;
                drUD34["ShortChar08"] = model.MCSSID;
                //drUD34["Key4"] = epiSession.UserID;
                drUD34["Key5"] = epiSession.PlantID;
                drUD34["Character01"] = String.IsNullOrEmpty(model.IDCoil.ToString()) ? "" : model.IDCoil.ToString();
                drUD34["Character02"] = String.IsNullOrEmpty(model.BaseMaterial) ? "" : model.BaseMaterial;
                drUD34["Character03"] = String.IsNullOrEmpty(model.CenterWaveRemark) ? "" : model.CenterWaveRemark;
                drUD34["Character04"] = String.IsNullOrEmpty(model.EdgeWaveRemark) ? "" : model.EdgeWaveRemark;
                drUD34["Character05"] = String.IsNullOrEmpty(model.OtherRemark) ? "" : model.OtherRemark;
                drUD34["Character06"] = String.IsNullOrEmpty(model.ODCoil.ToString()) ? "" : model.ODCoil.ToString(); ;
                drUD34["Character07"] = String.IsNullOrEmpty(model.ChemPersentRemark) ? "" : model.ChemPersentRemark; ;
                drUD34["Character08"] = String.IsNullOrEmpty(model.CategoryGroup3) ? "" : model.CategoryGroup3;
                drUD34["Character09"] = String.IsNullOrEmpty(model.CategoryGroup2) ? "" : model.CategoryGroup2;
                drUD34["Character10"] = String.IsNullOrEmpty(model.CategoryGroup1) ? "" : model.CategoryGroup1;
                drUD34["Number01"] = model.ChemPersent.GetInt();
                drUD34["Number02"] = model.Yield.GetInt();
                drUD34["Number03"] = model.Tensile.GetInt();
                drUD34["Number04"] = model.Elongation.GetInt();
                drUD34["Number06"] = model.CoreLoss.GetInt();
                drUD34["Number07"] = model.Magnatic.GetInt();
                drUD34["Number08"] = model.Oriented.GetInt();
                drUD34["Number12"] = model.EdgeWave.GetDecimal();
                drUD34["Number13"] = model.WeightPerCoilMin.GetDecimal();
                drUD34["Number14"] = model.WeightPerCoilMax.GetDecimal();
                drUD34["Number15"] = model.PackingStyle.GetInt();
                drUD34["Number16"] = model.CenterWave.GetInt();
                drUD34["Number17"] = model.Stainless.GetInt();
                drUD34["Number18"] = model.DistGI.GetInt();
                drUD34["Number19"] = model.DistHR.GetInt();
                drUD34["Number20"] = model.DistCR.GetInt();
                drUD34["CheckBox01"] = Convert.ToInt32(model.Welding);
                drUD34["CheckBox02"] = Convert.ToInt32(model.Painting);
                drUD34["CheckBox03"] = Convert.ToInt32(model.Degreasing);
                drUD34["CheckBox04"] = Convert.ToInt32(model.Blanking);
                drUD34["CheckBox05"] = Convert.ToInt32(model.ProcessOther);
                drUD34["CheckBox06"] = Convert.ToInt32(model.Commercial);
                drUD34["CheckBox07"] = Convert.ToInt32(model.Drawing);
                drUD34["CheckBox08"] = Convert.ToInt32(model.DeepDrawing);
                drUD34["CheckBox09"] = Convert.ToInt32(model.ExtraDeep);
                drUD34["CheckBox10"] = Convert.ToInt32(model.Folding);
                drUD34["CheckBox11"] = Convert.ToInt32(model.FormingOther);
                drUD34["CheckBox12"] = Convert.ToInt32(model.RoHS);
                drUD34["CheckBox13"] = Convert.ToInt32(model.PFOS);
                drUD34["CheckBox14"] = Convert.ToInt32(model.SOC);
                drUD34["CheckBox15"] = Convert.ToInt32(model.ELV);
                drUD34["CheckBox16"] = Convert.ToInt32(model.REACH);
                drUD34["CheckBox17"] = Convert.ToInt32(model.Other);
                drUD34["ShortChar01"] = string.IsNullOrEmpty(model.DistCRRemark) ? "" : model.DistCRRemark;
                drUD34["ShortChar02"] = string.IsNullOrEmpty(model.DistHRRemark) ? "" : model.DistHRRemark;
                drUD34["ShortChar03"] = string.IsNullOrEmpty(model.DistGIRemark) ? "" : model.DistGIRemark;
                drUD34["ShortChar04"] = string.IsNullOrEmpty(model.StainlessRemark) ? "" : model.StainlessRemark;
                drUD34["ShortChar05"] = string.IsNullOrEmpty(model.Hardness.GetString()) ? "" : model.Hardness.GetString(); //ChemPersentRemark
                drUD34["ShortChar06"] = string.IsNullOrEmpty(model.YieldRemark) ? "" : model.YieldRemark;
                drUD34["ShortChar07"] = string.IsNullOrEmpty(model.TensileRemark) ? "" : model.TensileRemark;
                drUD34["ShortChar08"] = string.IsNullOrEmpty(model.ElongationRemark) ? "" : model.ElongationRemark;
                drUD34["ShortChar09"] = string.IsNullOrEmpty(model.HardnessRemark) ? "" : model.HardnessRemark;
                drUD34["ShortChar10"] = string.IsNullOrEmpty(model.CoreLossRemark) ? "" : model.CoreLossRemark;
                drUD34["ShortChar11"] = string.IsNullOrEmpty(model.MagnaticRemark) ? "" : model.MagnaticRemark;
                drUD34["ShortChar12"] = string.IsNullOrEmpty(model.ProcessOtherRemark) ? "" : model.ProcessOtherRemark;
                drUD34["ShortChar13"] = string.IsNullOrEmpty(model.FormingOtherRemark) ? "" : model.FormingOtherRemark;
                drUD34["ShortChar14"] = string.IsNullOrEmpty(model.PartName) ? "" : model.PartName;
                drUD34["ShortChar15"] = string.IsNullOrEmpty(model.ProductName) ? "" : model.ProductName;
                drUD34["ShortChar16"] = string.IsNullOrEmpty(model.CusProcessRemark) ? "" : model.CusProcessRemark;
                drUD34["ShortChar17"] = string.IsNullOrEmpty(model.EndUser1) ? "" : model.EndUser1;
                drUD34["ShortChar18"] = string.IsNullOrEmpty(model.EndUser2) ? "" : model.EndUser2;
                drUD34["ShortChar19"] = string.IsNullOrEmpty(model.EndUser3) ? "" : model.EndUser3;
                drUD34["ShortChar20"] = string.IsNullOrEmpty(model.EndUser4) ? "" : model.EndUser4;
                drUD34.EndEdit();
                myUD34.Update(dsUD34);
                currSession.Dispose();

                IsSucces = true;
                msgError = "";
            }
            catch (Exception ex)
            {
                IsSucces = false;
                msgError = ex.Message;
            }
        }
开发者ID:swankham,项目名称:Epicoil,代码行数:101,代码来源:McssRepo.cs

示例11: SaveUD15

        public void SaveUD15(MCSS model, Models.SessionInfo epiSession, out bool IsSucces, out string msgError)
        {
            try
            {
                Session currSession = new Session(epiSession.UserID, epiSession.UserPassword, epiSession.AppServer, Session.LicenseType.Default);
                UD15 myUD15 = new UD15(currSession.ConnectionPool);
                UD15DataSet dsUD15 = new UD15DataSet();

                string whereClause = string.Format(@"UD15.Key1 ='{0}' AND UD15.Key5 = '{1}'", model.McssNum, epiSession.PlantID);
                bool morePages = false;
                bool dataExisting = false;

                try
                {
                    UD15DataSet ds = myUD15.GetByID(model.McssNum, "", "", "", epiSession.PlantID);
                    dataExisting = true;
                }
                catch (Exception ex)
                {
                    if (ex.Message == "Record not found.") dataExisting = false;
                }

                if (dataExisting)
                {
                    dsUD15 = myUD15.GetRows(whereClause, "", 0, 1, out morePages);
                }
                else
                {
                    myUD15.GetaNewUD15(dsUD15);
                }

                DataRow drUD15 = dsUD15.Tables[0].Rows[0];
                drUD15.BeginEdit();
                drUD15["Key1"] = string.IsNullOrEmpty(model.McssNum) ? "1" : model.McssNum;
                //drUD15["Key2"] = "1";
                drUD15["ShortChar08"] = model.MCSSID;
                drUD15["ShortChar20"] = epiSession.UserID;
                drUD15["Key5"] = epiSession.PlantID;
                drUD15["Character01"] = String.IsNullOrEmpty(model.BussinessTypeName) ? "" : model.BussinessTypeName;
                drUD15["Character02"] = "";
                drUD15["Character03"] = string.IsNullOrEmpty(model.Name) ? "" : model.Name;
                drUD15["Character04"] = string.IsNullOrEmpty(model.TISINo) ? "" : model.TISINo;
                drUD15["Character05"] = string.IsNullOrEmpty(model.LicenseNo) ? "" : model.LicenseNo;
                drUD15["Character06"] = "";
                drUD15["Character07"] = model.OillingVal.GetDecimal();
                drUD15["Character08"] = string.IsNullOrEmpty(model.BusinessRoute) ? "" : model.BusinessRoute;
                drUD15["Character09"] = string.IsNullOrEmpty(model.BusinessRemark) ? "" : model.BusinessRemark;
                drUD15["Character10"] = string.IsNullOrEmpty(model.Remark) ? "" : model.Remark;
                drUD15["Number01"] = model.Thick.GetDecimal();
                drUD15["Number02"] = model.Width.GetDecimal();
                drUD15["Number03"] = model.Length.GetDecimal();
                drUD15["Number04"] = model.CoatingWeight1.GetDecimal();
                drUD15["Number05"] = model.CoatingWeight2.GetDecimal();
                drUD15["Number06"] = model.POAllowance.GetDecimal();
                drUD15["Number07"] = model.QuantityPerMonth.GetDecimal();
                drUD15["Number08"] = model.StandardRef.GetInt();
                drUD15["Number09"] = model.ThicknessTolerance.GetInt();
                drUD15["Number10"] = model.Pocession.GetInt();
                drUD15["Number11"] = model.WidthStandard.GetInt();
                drUD15["Number12"] = model.Oilling.GetInt();
                drUD15["Number15"] = model.QuantityPerPlant.GetDecimal();
                drUD15["Number17"] = model.ThicknessTolerValPos.GetDecimal();
                drUD15["Number18"] = model.ThicknessTolerValNeg.GetDecimal();
                drUD15["Number19"] = model.WidthStdPos.GetDecimal();
                drUD15["Number20"] = model.WidthStdNeg.GetDecimal();
                drUD15["Date01"] = DateTime.Now.ToLongDateString();
                drUD15["CheckBox01"] = Convert.ToInt32(model.TISIFlag);
                drUD15["ShortChar01"] = string.IsNullOrEmpty(model.MakerCode) ? "" : model.MakerCode;
                drUD15["ShortChar02"] = string.IsNullOrEmpty(model.MillCode) ? "" : model.MillCode;
                drUD15["ShortChar03"] = string.IsNullOrEmpty(model.SupplierCode) ? "" : model.SupplierCode;
                drUD15["ShortChar04"] = string.IsNullOrEmpty(model.CustID) ? "" : model.CustID;
                drUD15["ShortChar05"] = string.IsNullOrEmpty(model.CategoryGroupHead1) ? "" : model.CategoryGroupHead1;
                drUD15["ShortChar06"] = string.IsNullOrEmpty(model.CommodityCode) ? "" : model.CommodityCode;
                drUD15["ShortChar07"] = string.IsNullOrEmpty(model.CustomerTypeRemark) ? "" : model.CustomerTypeRemark;
                drUD15["ShortChar09"] = string.IsNullOrEmpty(model.Coating1) ? "" : model.Coating1;
                drUD15["ShortChar10"] = string.IsNullOrEmpty(model.CustomerType.ToString()) ? "" : model.CustomerType.ToString();
                drUD15["ShortChar11"] = string.IsNullOrEmpty(model.MatSpec1) ? "" : model.MatSpec1;
                drUD15["ShortChar13"] = string.IsNullOrEmpty(model.BussinessType) ? "" : model.BussinessType;
                drUD15["ShortChar14"] = string.IsNullOrEmpty(model.StandardRefRemark) ? "" : model.StandardRefRemark;
                drUD15["ShortChar15"] = string.IsNullOrEmpty(model.Number) ? "" : model.Number;
                drUD15.EndEdit();
                myUD15.Update(dsUD15);
                currSession.Dispose();

                IsSucces = true;
                msgError = "";
            }
            catch (Exception ex)
            {
                IsSucces = false;
                msgError = ex.Message;
            }
        }
开发者ID:swankham,项目名称:Epicoil,代码行数:93,代码来源:McssRepo.cs

示例12: Progression_Load

        private void Progression_Load(object sender, EventArgs e)
        {
            bool success;
            string msg;
            var result = _repo.GetNewPartCollection(TransactionID);

            prgBar.Minimum = 0;
            prgBar.Maximum = result.Count();

            int i = 0;
            if (result != null)
            {
                //Initial Session to Epicor
                Session currSession = new Session(_session.UserID, _session.UserPassword, _session.AppServer, Session.LicenseType.Default);

                //Loop to get new part in Epicor

                foreach (var item in result)
                {
                    item.iRunning = _repo.RunningPart();
                    item.SerialNo = _repo.GetSerialByFormat(item.iRunning);// +"-DEMO";
                    lblDescription.Text = "Create Part Rows completed : " + (i + 1).ToString();

                    _repo.NewPartCollection(item, currSession, out success, out msg);
                    _repo.UpdateArticleToStoreIn(item.TransactionLineID, item.SerialNo);
                    _repo.UpdateStock(item.SerialNo, 1M);
                    i++;
                    prgBar.Value = i;
                }

                if (Possession != 2)
                {
                    lblDescription.Text = "Receipt PO...";
                    //Get data to new Receipt PO in Epicor
                    var rcvResult = _repo.GetDataToNewReceiptPO(TransactionID);
                    _repo.UpdatePOReleaseQty(currSession, rcvResult.PONum.ToString(), out msg);
                    //List<ReceiptDetailModel> line = new List<ReceiptDetailModel>();
                    var line = _repo.GetPODetailToReceipt(TransactionID).ToList();
                    _repo.GetNewRcv(rcvResult, line, currSession, out success, out msg);
                }

                //Dispose Epicor Session
                currSession.Dispose();

            }
            MessageBox.Show("Save completed.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
开发者ID:swankham,项目名称:Epicoil,代码行数:48,代码来源:Progression.cs


注:本文中的Session.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。