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


C# Session.CommitTransaction方法代码示例

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


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

示例1: GetInstance

        public static ProdOrderSetting GetInstance(Session session)
        {
            ProdOrderSetting setting = session.FindObject<ProdOrderSetting>(null);

            if (setting == null)
            {
                session.BeginTransaction();
                setting = new ProdOrderSetting(session);
                setting.Save();
                session.CommitTransaction();
            }

            return setting;
        }
开发者ID:kamchung322,项目名称:Namwah,代码行数:14,代码来源:ProdOrderSetting.cs

示例2: GetInstance

        public static ProdRouteListDateSetting GetInstance(Session session)
        {
            ProdRouteListDateSetting setting = session.FindObject<ProdRouteListDateSetting>(null);

            if (setting == null)
            {
                session.BeginTransaction();
                setting = new ProdRouteListDateSetting(session);
                setting.LastReportDate = DateTime.Today.AddYears(-10);
                setting.Save();
                session.CommitTransaction();
            }

            return setting;
        }
开发者ID:kamchung322,项目名称:Namwah,代码行数:15,代码来源:ProdRouteListDateSetting.cs

示例3: btnUpdateExcelPOPromisedDate_Execute

        private void btnUpdateExcelPOPromisedDate_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            string filePath = "";

            System.Windows.Forms.OpenFileDialog fileDialog = new System.Windows.Forms.OpenFileDialog();
            fileDialog.Filter = "Excel Files (*.xls)|*.xls";
            fileDialog.ShowDialog();

            filePath = fileDialog.FileName.Trim();

            if (filePath == "")
                return;

            Excel.Application xlApp = new Excel.Application();
            xlApp.Caption = "NWMMS - " + DateTime.Now.ToLongTimeString();
            Excel.Workbook xlWb;
            Excel.Worksheet xlSht;
            Session session = new Session();
            session.BeginTransaction();

            try
            {
                xlWb = ExcelHelper.OpenWB(xlApp, filePath);
                xlSht = ExcelHelper.GetWorkSheetByName(xlWb, "采购单供应商");

                if (xlSht == null)
                    throw new Exception("找不到采购单供应商页");

                const int COL_PONO = 2, COL_VENDORPROJ = 17, COL_STATUS = 18;
                int row = 5;
                do
                {
                    try
                    {
                        string poNo = ExcelHelper.GetCellStringValue(xlSht, row, COL_PONO);
                        string PromisedDateList = ExcelHelper.GetCellStringValue(xlSht, row, COL_VENDORPROJ);

                        PurchOrderLine poLine = PurchOrderLine.Find(session, poNo);

                        if (poLine == null)
                            throw new Exception("找不到此采购单资料");

                        if (poLine.UpdatePromisedDate(PromisedDateList) && PromisedDateList != "")
                            xlSht.Cells[row, COL_STATUS] = "成功输入系统";

                        row++;
                    }
                    catch (Exception ex)
                    {
                        xlSht.Cells[row, COL_STATUS] = ex.Message;
                    }
                }
                while (ExcelHelper.GetCellStringValue(xlSht, row, COL_PONO) != "");
                xlWb.Save();
                XtraMessageBox.Show("已完成导入供应商覆期");
            }
            catch
            {
                XtraMessageBox.Show(string.Format("不能开启此EXCEL表 : {0}.  请确认此EXCEL表为系统所建立的WIP报表 !!", filePath));
            }

            ExcelHelper.KillExcelProcess(xlApp);
            xlSht = null;
            xlWb = null;
            session.CommitTransaction();
        }
开发者ID:kamchung322,项目名称:Namwah,代码行数:66,代码来源:PurchOrderLine_View.cs

示例4: GetWoPurchaseOrders

        public void GetWoPurchaseOrders(Session s)
        {
            this._StartTime = DateTime.Now;
            this._woPurchOrders = this.CalcWoPurchOrder(s);
            this._EndTime = DateTime.Now;

            s.BeginTransaction();
            mpPurchOrderSetting Setting = mpPurchOrderSetting.GetInstance(s);
            Setting.WorkOrder = WorkOrder;
            Setting.LastLoadDate = DateTime.Now;
            Setting.StoreWH = StoreWH;
            Setting.Save();
            s.CommitTransaction();
        }
开发者ID:kamchung322,项目名称:Namwah,代码行数:14,代码来源:mpPurchOrder.cs

示例5: GetInstance

        public static ShipmentSetting GetInstance(Session session)
        {
            ShipmentSetting setting = session.FindObject<ShipmentSetting>(null);

            if (setting == null)
            {
                session.BeginTransaction();
                setting = new ShipmentSetting(session);
                setting.Name = "ShipmentSetting";
                setting.NoOfDay = 7;
                setting.IncludeSSTK = false;
                setting.SortBy = SortType.PriorityDate;
                setting.Save();
                session.CommitTransaction();
            }

            return setting;
        }
开发者ID:kamchung322,项目名称:Namwah,代码行数:18,代码来源:ShipmentSetting.cs

示例6: CreateSubjectTimetableData

        public static XPCollection<WeekReportData> CreateSubjectTimetableData(Session session, string subjectCode, string semesterName)
        {
            ConstrainstParameter cp = session.FindObject<ConstrainstParameter>(
               new BinaryOperator("Code", "AFTERNOONPERIODCOUNT"));
            int afternoonPeriodCount = Convert.ToInt32(cp.Value);

            cp = session.FindObject<ConstrainstParameter>(
               new BinaryOperator("Code", "MORNINGPERIODCOUNT"));
            int morningPeriodCount = Convert.ToInt32(cp.Value);

            try
            {
                using (XPCollection<WeekReportData> xpw = new XPCollection<WeekReportData>(session,
                           new ContainsOperator("Subjects", new BinaryOperator("SubjectCode", subjectCode))))
                {

                    session.Delete(xpw);
                    session.CommitTransaction();
                    using (XPCollection<TkbSemester> xpctkbSemester = new XPCollection<TkbSemester>(session,
                        new GroupOperator(GroupOperatorType.And, new BinaryOperator("Lesson.Semester.SemesterName",
                            semesterName), new BinaryOperator("Lesson.Subject.SubjectCode", subjectCode))))
                    {

                        Dictionary<string, WeekReportData> dicTimePeriodforWeekData = new Dictionary<string, WeekReportData>();
                        WeekReportData currentWeekData;
                        NestedUnitOfWork UOW =session.BeginNestedUnitOfWork();
                        UOW.BeginTransaction();
                        foreach (TkbSemester tkbSem in xpctkbSemester)
                        {
                            string[] strperiod = tkbSem.Period.Split(',');
                            List<string> periodTimeList = new List<string>();
                            foreach (string s in strperiod)
                            {
                                if (Convert.ToInt32(s) >= 1 && Convert.ToInt32(s) <= morningPeriodCount)
                                    if (!periodTimeList.Contains("Sáng"))
                                        periodTimeList.Add("Sáng");
                                if (Convert.ToInt32(s) > morningPeriodCount && Convert.ToInt32(s) <= (morningPeriodCount + afternoonPeriodCount))
                                    if (!periodTimeList.Contains("Chiều"))
                                        periodTimeList.Add("Chiều");
                                if (Convert.ToInt32(s) > (morningPeriodCount + afternoonPeriodCount))
                                    if (!periodTimeList.Contains("Tối"))
                                        periodTimeList.Add("Tối");
                            }

                            foreach (String period in periodTimeList)
                            {
                                if (!dicTimePeriodforWeekData.ContainsKey(period))
                                {
                                    currentWeekData = new WeekReportData(UOW);
                                    currentWeekData.Semester = UOW.FindObject<Semester>(
                                        CriteriaOperator.Parse("SemesterName = ?", semesterName));
                                    currentWeekData.Subjects.Add(UOW.FindObject<Subject>(
                                        CriteriaOperator.Parse("SubjectCode=?", subjectCode)));
                                    currentWeekData.PeriodTime = period;
                                    dicTimePeriodforWeekData.Add(period, currentWeekData);
                                }

                                dicTimePeriodforWeekData[period][tkbSem.Day] += string.Format("Lớp:{0}\r\n Môn:{1}-{2}\r\nTiết:{3}\r\nTuần:{4}\r\n\r\n",
                                        tkbSem.Lesson.ClassIDs, tkbSem.Lesson.Subject.SubjectCode, tkbSem.Lesson.Subject.SubjectName,
                                        Utils.ShortStringPeriod(tkbSem.Period), Utils.ShortStringWeek(tkbSem.StringWeeks));
                            }

                        }
                        UOW.CommitTransaction();
                        session.CommitTransaction();
                    }

                }
            }

            catch (Exception ex)
            {
                throw new UserFriendlyException("Lỗi thực hiện: " + ex.Message);
            }

            return new XPCollection<WeekReportData>(session,
                        new GroupOperator(GroupOperatorType.And, new BinaryOperator("Semester.SemesterName",
                         semesterName), new ContainsOperator("Subjects", new BinaryOperator("SubjectCode", subjectCode))));
        }
开发者ID:dedangkyphanmem,项目名称:vidodkmh,代码行数:79,代码来源:Utilities.cs

示例7: CreateStudentClassTransactionTrackingData

        public static XPCollection<AccountTransactionTracking> CreateStudentClassTransactionTrackingData(Session session, string classCode, string semesterName)
        {
            try
            {
                using (XPCollection<AccountTransactionTracking> xpw = new XPCollection<AccountTransactionTracking>(session,
                               new BinaryOperator("Student.StudentClass.ClassCode", classCode)))
                {
                    session.Delete(xpw);
                    session.CommitTransaction();

                    StudentClass studentClass = session.FindObject<StudentClass>(
                        new BinaryOperator("ClassCode", classCode));
                    Semester semester = session.FindObject<Semester>(
                        new BinaryOperator("SemesterName", semesterName));
                    DateTime semesterLastDate = semester.StartDate.AddDays(semester.NumberOfWeek * 7);

                    decimal beforedebtvalue = 0;
                    decimal requestvalue = 0;
                    decimal paidvalue = 0;

                    if (studentClass != null && semester != null)
                    {
                        //NestedUnitOfWork UOW = session.BeginNestedUnitOfWork();
                        //UOW.BeginTransaction();
                        foreach (Student student in studentClass.Students)
                        {
                            beforedebtvalue = 0;
                            requestvalue = 0;
                            paidvalue = 0;
                            foreach (AccountTransaction accTrans in student.AccountTransactions)
                            {
                                if ((accTrans.Semester != null &&
                                    Convert.ToInt32(accTrans.Semester.SemesterName) < Convert.ToInt32(semester.SemesterName)))
                                    //||accTrans.TransactingDate < semester.StartDate)

                                    beforedebtvalue += accTrans.MoneyAmount;

                                else if ((accTrans.Semester != null && accTrans.Semester.SemesterName == semester.SemesterName))
                                    //||accTrans.TransactingDate <= semesterLastDate )
                                {
                                    if (accTrans.MoneyAmount < 0) //money has to paid
                                    {
                                        requestvalue += (-accTrans.MoneyAmount);
                                    }
                                    else //money has paid
                                    {
                                        paidvalue += accTrans.MoneyAmount;
                                    }
                                }
                            }

                            AccountTransactionTracking accTracking = new AccountTransactionTracking(session);
                            accTracking.Student = student;
                            accTracking.Semester = semester;
                            accTracking.BeforeDebtValue = - beforedebtvalue;
                            accTracking.PaidValue = paidvalue;
                            accTracking.RequestValue = requestvalue;
                            accTracking.Save();
                        }
                        //UOW.CommitTransaction();
                        session.CommitTransaction();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new UserFriendlyException("Lỗi thực hiện: " + ex.Message);
            }
            return new XPCollection<AccountTransactionTracking>(session,
                       new BinaryOperator("Student.StudentClass.ClassCode", classCode));
        }
开发者ID:dedangkyphanmem,项目名称:vidodkmh,代码行数:71,代码来源:Utilities.cs

示例8: CreateStudentClassTrackingData

        public static XPCollection<ClassTransactionTracking> CreateStudentClassTrackingData(Session session, string semesterName)
        {
            string strParse = "";
            try
            {
                using (XPCollection<StudentClass> xpw = new XPCollection<StudentClass>(session))
                {
                    NestedUnitOfWork UOW = session.BeginNestedUnitOfWork();
                    UOW.BeginTransaction();

                    foreach (StudentClass studentClass in xpw)
                    {

                        ClassTransactionTracking ct = UOW.FindObject<ClassTransactionTracking>
                            (CriteriaOperator.Parse("StudentClass.ClassCode = ? and Semester.SemesterName = ?",
                            studentClass.ClassCode, semesterName));
                        if (ct == null)
                        {
                            ct = new ClassTransactionTracking(UOW);
                            ct.Semester = UOW.FindObject<Semester>(CriteriaOperator.Parse("SemesterName=?", semesterName));
                            ct.StudentClass = UOW.FindObject<StudentClass>(CriteriaOperator.Parse("ClassCode=?", studentClass.ClassCode));
                            ct.Save();
                        }

                        strParse += (strParse == "" ? string.Format("StudentClass.ClassCode='{0}'", studentClass.ClassCode) :
                            string.Format(" or StudentClass.ClassCode='{0}'", studentClass.ClassCode));
                    }
                    UOW.CommitTransaction();
                    session.CommitTransaction();
                    strParse = string.Format("({0}) and Semester.SemesterName= '{1}'", strParse, semesterName);
                }
            }
            catch (Exception ex)
            {
                throw new UserFriendlyException(string.Format("Lỗi thực hiện: {0}\r\n Strack trace:{1}",ex.Message,ex.StackTrace));
            }
            return new XPCollection<ClassTransactionTracking>(session, CriteriaOperator.Parse(strParse));
        }
开发者ID:dedangkyphanmem,项目名称:vidodkmh,代码行数:38,代码来源:Utilities.cs

示例9: GetInstance

        public static SystemSetting GetInstance(Session session)
        {
            SystemSetting setting = session.FindObject<SystemSetting>(null);

            if (setting == null)
            {
                session.BeginTransaction();
                setting = new SystemSetting(session);
                setting.ReportPath = @"\\" + ServerHelper.ServerName + @"\_NWS\" + ServerHelper.Database + @"\ReportTemplate\";
                setting.ImagePath = @"\\" + ServerHelper.ServerName + @"\_NWS\" + ServerHelper.Database + @"\Image\";
                setting.Save();
                session.CommitTransaction();
            }

            return setting;
        }
开发者ID:kamchung322,项目名称:Namwah,代码行数:16,代码来源:SystemSetting.cs

示例10: CreateNewRowTimekeeping

        private void CreateNewRowTimekeeping(Session session, string value,
            Guid loaiDuLieuChamCongOid, Guid tenBangChamCongOid, Guid nhanVienOid, Guid PhongBanOid, int index, ref List<string> strArr)
        {
            string s = string.Format("SELECT * FROM \"TimekeepingMonth\" WHERE" +
                    "\"TimekeepingName\" = '{0}' AND \"Employee\" = '{1}' AND \"DataTypeTimekeeping\" = '{2}'",
                tenBangChamCongOid, nhanVienOid, loaiDuLieuChamCongOid);
            SelectedData data = session.ExecuteQuery(s);
            //if(session.FindObject<TimekeepingMonth>(CriteriaOperator.And(new BinaryOperator("TimekeepingName.Oid", tenBangChamCongOid),
            //    new BinaryOperator("Employee.Oid",nhanVienOid), new BinaryOperator("DataTypeTimekeeping.Oid",loaiDuLieuChamCongOid))) == null)
            if(data.ResultSet[0].Rows.Length == 0)
            {
                session.BeginTransaction();
                Guid id = Guid.NewGuid();
                while (true)
                {
                    try
                    {

                        s = string.Format("INSERT INTO \"TimekeepingMonth\" (\"Oid\",\"TimekeepingName\", \"Employee\", \"Department\", \"DataTypeTimekeeping\", \"Ngay" + index.ToString() + "\")" +
                        "VALUES ('{4}','{0}','{1}','{2}','{3}')", tenBangChamCongOid, nhanVienOid, PhongBanOid, loaiDuLieuChamCongOid, value, id);
                        session.ExecuteNonQuery(s);
                        break;
                    }
                    catch
                    {
                        id = Guid.NewGuid();
                    }
                }
                session.CommitTransaction();
            }
            else
            {
                strArr.Add(string.Format("UPDATE \"TimekeepingMonth\" SET \"Ngay" + index.ToString() + "\" = '{3}', \"Department\" = '{4}', \"OptimisticLockField\" = null, \"GCRecord\" = null WHERE " +
                    "\"TimekeepingName\" = '{0}' AND \"Employee\" = '{1}' AND \"DataTypeTimekeeping\" = '{2}'",
                tenBangChamCongOid, nhanVienOid, loaiDuLieuChamCongOid, value,PhongBanOid));
            }
        }
开发者ID:phuonguit2015,项目名称:EasyHRM,代码行数:37,代码来源:TimekeepingViewController.cs

示例11: CreateShipment

        public void CreateShipment(Session s)
        {
            s.BeginTransaction();

            foreach (SalesLineWithWarehouse slWithWH in SalesLine)
            {
                if (slWithWH.AvailQty > 0)
                    slWithWH.SalesOrderLine.CreateShipment(s, slWithWH.AvailQty);
            }

            s.CommitTransaction();
        }
开发者ID:kamchung322,项目名称:Namwah,代码行数:12,代码来源:Shipment_FromWH.cs

示例12: update

        /// <summary>
        /// Update event
        /// </summary>
        /// <param name="name">Event Name</param>
        public static void update(string name, Session session1)
        {
            XpoSQLTriggerInfo trigger;
            try
            {
                trigger = session1.FindObject<XpoSQLTriggerInfo>(CriteriaOperator.Parse("[triggerName] = '" + name + "'"));

                session1.BeginTransaction();
                if (trigger != null)
                {
                    trigger.timestamp = (DateTime)session1.Evaluate(typeof(XPObjectType), new FunctionOperator(FunctionOperatorType.Now), null);
                    trigger.Save();
                }
                session1.CommitTransaction();
            }
            catch { }
        }
开发者ID:Sunnking,项目名称:som3-classes-xposqltriggers,代码行数:21,代码来源:XpoSQLTrigger.cs

示例13: ImportFromXML


//.........这里部分代码省略.........
                            case "customer":
                                customer = reader.ReadString();
                                break;
                        }

                        break;
                    case XmlNodeType.EndElement: //Display

                        if (reader.LocalName.Equals("timex-po"))
                        {
                            string key = poNo + customerItemNo + needDate.ToShortDateString() ;

                            if (dictOrderLine.ContainsKey(key))
                            {
                                orderLine = dictOrderLine[key];
                                orderLine.NeedQty = orderLine.NeedQty + needQty;
                                orderLine.Save();
                            }
                            else
                            {
                                if (dictSO.ContainsKey(poNo))
                                {
                                    orderLine = SalesOrderLine.Create(dictSO[poNo], customerItemNo, customerItemName, price, needQty, needDate, remark, ref errMsg, session);
                                }
                                else
                                {
                                    orderLine = SalesOrderLine.Create(poNo, customer, customerItemNo, customerItemName, price, needQty, needDate, remark, ref errMsg, session);
                                    dictSO.Add(poNo, orderLine.SalesOrder);
                                }

                                if (errMsg == "")
                                {
                                    dictOrderLine.Add(key, orderLine);
                                }
                                else
                                {
                                    if (dictSummary.ContainsKey("ERROR"))
                                        dictSummary["ERROR"] = dictSummary["ERROR"] + needQty;
                                    else
                                        dictSummary.Add("ERROR", needQty);

                                    int poIndex = 1;

                                    if (dictPOIndex.ContainsKey(poNo))
                                    {
                                        poIndex = dictPOIndex[poNo] + 1;
                                        dictPOIndex[poNo] = poIndex;
                                    }
                                    else
                                    {
                                        dictPOIndex.Add(poNo, poIndex);
                                    }

                                    sbResult.AppendLine(string.Format(summaryLine, poNo, poIndex, customerItemNo, needQty, needDate.ToShortDateString(), "$ ---", customerItemName, "***" + errMsg));
                                }
                            }

                            poNo = "";
                            customerItemNo = "";
                            customerItemName = "";
                            customer = "Timex";
                            remark = "";
                            needQty = 0;
                            price = 0;
                        }
                        break;
                }
            }

            foreach (SalesOrderLine oLine in dictOrderLine.Values)
            {
                int poIndex = 1;
                poNo = oLine.SalesOrder.OrderNo;
                if (dictPOIndex.ContainsKey(poNo))
                {
                    poIndex = dictPOIndex[poNo] + 1;
                    dictPOIndex[poNo] = poIndex;
                }
                else
                {
                    dictPOIndex.Add(poNo, poIndex);
                }

                sbResult.AppendLine(string.Format(summaryLine, oLine.SalesOrder.OrderNo, poIndex, oLine.CustomerItemNo, oLine.NeedQty, oLine.NeedDate.ToShortDateString(), "$ ---", oLine.CustomerItemName, ""));
                string key = "";

                if (oLine.Item.ItemType.ItemTypeName == "BezelAssembly")
                    key = "Bezel" + oLine.Item.Material;
                else
                    key = oLine.Item.ItemType.ItemTypeName;

                if (dictSummary.ContainsKey(key))
                    dictSummary[key] = dictSummary[key] + oLine.NeedQty;
                else
                    dictSummary.Add(key, oLine.NeedQty);
            }
            session.CommitTransaction();

            System.Diagnostics.Debug.Write(sbResult.ToString());
        }
开发者ID:kamchung322,项目名称:Namwah,代码行数:101,代码来源:SalesOrder.cs

示例14: btnCancelPORemainByExcel_Execute

        private void btnCancelPORemainByExcel_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            string filePath = "";

            System.Windows.Forms.OpenFileDialog fileDialog = new System.Windows.Forms.OpenFileDialog();
            fileDialog.Filter = "Excel Files (*.xls)|*.xls";
            fileDialog.ShowDialog();

            filePath = fileDialog.FileName.Trim();

            if (filePath == "")
                return;

            Excel.Application xlApp = new Excel.Application();
            xlApp.Caption = "NWMMS - " + DateTime.Now.ToLongTimeString();
            Excel.Workbook xlWb;
            Excel.Worksheet xlSht;
            Session session = new Session();
            session.BeginTransaction();

            try
            {
                xlWb = ExcelHelper.OpenWB(xlApp, filePath);
                xlSht = ExcelHelper.GetWorkSheetByName(xlWb, "Sheet1");

                if (xlSht == null)
                    throw new Exception("Sheet1");

                const int COL_PONO = 1;
                int row = 5;
                do
                {
                    try
                    {
                        string poNo = ExcelHelper.GetCellStringValue(xlSht, row, COL_PONO);
                        PurchOrderLine poLine = PurchOrderLine.Find(session, poNo);

                        if (poLine == null)
                        {
                            xlSht.Cells[row, 2] = "No Po";
                        }
                        else
                        {
                            poLine.ChangeCancelQty(poLine.CancelQty + poLine.BalQty);
                            poLine.Save();
                            xlSht.Cells[row, 2] = "ok";
                        }

                        row++;
                    }
                    catch (Exception ex)
                    {
                        xlSht.Cells[row, 2] = ex.Message;
                    }
                }
                while (ExcelHelper.GetCellStringValue(xlSht, row, COL_PONO) != "");
                xlWb.Save();
                XtraMessageBox.Show("已完成取消余数");
            }
            catch
            {
                XtraMessageBox.Show(string.Format("不能开启此EXCEL表 : {0}.  请确认此EXCEL表为系统所建立的WIP报表 !!", filePath));
            }

            ExcelHelper.KillExcelProcess(xlApp);
            xlSht = null;
            xlWb = null;
            session.CommitTransaction();
        }
开发者ID:kamchung322,项目名称:Namwah,代码行数:69,代码来源:PurchOrderLine_View.cs

示例15: CreateStudentAccumulation

 public static void CreateStudentAccumulation(Session session, string studentCode)
 {
     bool isTrans = false;
     try
     {
         using (XPCollection<Semester> xpw = new XPCollection<Semester>(session,
                        new ContainsOperator("Lessons", new ContainsOperator("StudentResults", new
                            BinaryOperator("Student.StudentCode",studentCode)))))
         {
             foreach (Semester s in xpw)
             {
                 XPCollection<StudentAccumulation> xpa = new XPCollection<StudentAccumulation>(session,
                     new GroupOperator(GroupOperatorType.And,
                         new BinaryOperator("Student.StudentCode", studentCode),
                         new BinaryOperator("Semester.SemesterName", s.SemesterName)));
                 if (xpa.Count == 0)
                 {
                     StudentAccumulation sa = new StudentAccumulation(session)
                     {
                         Student = session.FindObject<Student>(new BinaryOperator("StudentCode",studentCode)),
                         Semester = s
                     };
                     sa.Save();
                     isTrans = true;
                 }
             }
             if (isTrans)
                 session.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         throw new UserFriendlyException("Lỗi thực hiện: " + ex.Message);
     }
 }
开发者ID:dedangkyphanmem,项目名称:vidodkmh,代码行数:35,代码来源:Utilities.cs


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