コード例 #1
0
        protected override void Import(DataTable ExcelContentTable)
        {
            object[] employeeCode;
            int      num = 0;

            foreach (DataRow row in ExcelContentTable.Rows)
            {
                if (num != 0)
                {
                    HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE();
                    try
                    {
                        hRMPROCESSADVANCE.AdvanceID    = Guid.NewGuid();
                        hRMPROCESSADVANCE.EmployeeCode = row[this.ParamNameIndex[0]].ToString();
                        hRMPROCESSADVANCE.Reason       = row[this.ParamNameIndex[3]].ToString();
                        try
                        {
                            hRMPROCESSADVANCE.Money = decimal.Parse(row[this.ParamNameIndex[4]].ToString());
                        }
                        catch
                        {
                            hRMPROCESSADVANCE.Money = new decimal(0);
                        }
                        try
                        {
                            Perfect.Utils.MyDateTime.GetValueFromString(row[this.ParamNameIndex[5]].ToString());
                            hRMPROCESSADVANCE.Date = new DateTime(Perfect.Utils.MyDateTime.Year, Perfect.Utils.MyDateTime.Month, Perfect.Utils.MyDateTime.Day);
                        }
                        catch
                        {
                            hRMPROCESSADVANCE.Date = DateTime.Now;
                        }
                        hRMPROCESSADVANCE.Person = row[this.ParamNameIndex[6]].ToString();
                        if (!(hRMPROCESSADVANCE.Insert() == "OK"))
                        {
                            employeeCode = new object[] { "Dòng thứ ", num, " => ", hRMPROCESSADVANCE.EmployeeCode, ": Trùng mã nhân viên" };
                            base.ErrorRow(string.Concat(employeeCode));
                        }
                        else
                        {
                            base.SuccessRow();
                        }
                    }
                    catch (Exception exception1)
                    {
                        Exception exception = exception1;
                        employeeCode = new object[] { "Dòng thứ ", num, " => ", hRMPROCESSADVANCE.EmployeeCode, exception.ToString() };
                        base.ErrorRow(string.Concat(employeeCode));
                    }
                    base.ProgressRow(string.Concat("Đang nạp dữ liệu... ", hRMPROCESSADVANCE.EmployeeCode, "..."));
                    num++;
                }
                else
                {
                    num++;
                }
            }
        }
コード例 #2
0
        protected override string uc_Save()
        {
            string str;

            if (MyRule.Get(MyLogin.RoleId, "bbiProcessAdvance") != "OK")
            {
                str = "";
            }
            else if (!MyRule.AllowAdd)
            {
                MyRule.Notify();
                str = "";
            }
            else if (!(this.m_EmployeeCode == ""))
            {
                //  SYS_LOG.Insert("Quá Trình Tạm Ứng", "Thêm", this.m_AdvanceID.ToString());
                base.SetWaitDialogCaption("Đang lưu dữ liệu...");
                Cursor.Current = Cursors.WaitCursor;
                HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE()
                {
                    AdvanceID    = Guid.NewGuid(),
                    EmployeeCode = this.m_EmployeeCode,
                    Reason       = this.txtReason.Text,
                    Date         = this.dtDate.DateTime,
                    Money        = decimal.Parse(this.calMoney.Text.ToString()),
                    Person       = this.cboPerson.Text
                };
                string str1 = hRMPROCESSADVANCE.Insert();
                if (str1 == "OK")
                {
                    this.RaiseSuccessEventHander(hRMPROCESSADVANCE);
                }
                Cursor.Current = Cursors.Default;
                this.DoHide();
                if (str1 != "OK")
                {
                    XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                str = str1;
            }
            else
            {
                XtraMessageBox.Show("Vui lòng chọn nhân viên để lưu dữ liệu!", "Thông Báo", MessageBoxButtons.OK);
                str = "";
            }
            return(str);
        }
コード例 #3
0
        public void Save()
        {
            HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE();

            hRMPROCESSADVANCE.DeleteByMonth(this.m_EmployeeCode, this.m_Month, this.m_Year);
            try
            {
                foreach (DataRow row in (this.gcList.DataSource as DataTable).Rows)
                {
                    Guid guid = Guid.NewGuid();
                    hRMPROCESSADVANCE.Insert(guid, this.m_EmployeeCode, row["Reason"].ToString(), DateTime.Parse(row["Date"].ToString()), decimal.Parse(row["Money"].ToString()), row["Person"].ToString());
                }
                this.UpdateEmployeeSalary();
                this.RaiseSavedHander();
            }
            catch
            {
            }
        }