示例#1
0
 private void Insert()
 {
     try
     {
         var schedulerType = new SchedulerType
         {
             Name        = txtName.Text.Trim(),
             DisplayName = txtDisplayName.Text.Trim()
         };
         if (!string.IsNullOrEmpty(txtDescription.Text))
         {
             schedulerType.Description = txtDescription.Text.Trim();
         }
         int status;
         if (int.TryParse(cbxSchedulerTypeStatus.SelectedItem.Value, out status))
         {
             schedulerType.Status = (SchedulerTypeStatus)status;
         }
         schedulerType.Status = (SchedulerTypeStatus)status;
         SchedulerTypeServices.Create(schedulerType);
         wdTimeSheetRule.Hide();
     }
     catch (Exception ex)
     {
         Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(ex.Message));
     }
 }
示例#2
0
 private void Update()
 {
     try
     {
         if (string.IsNullOrEmpty(hdfKeyRecord.Text))
         {
             return;
         }
         var schedulerType = SchedulerTypeServices.GetById(Convert.ToInt32(hdfKeyRecord.Text));
         if (schedulerType == null)
         {
             return;
         }
         schedulerType.Name        = txtName.Text.Trim();
         schedulerType.DisplayName = txtDisplayName.Text.Trim();
         schedulerType.Description = txtDescription.Text.Trim();
         int status;
         if (int.TryParse(cbxSchedulerTypeStatus.SelectedItem.Value, out status))
         {
             schedulerType.Status = (SchedulerTypeStatus)status;
         }
         SchedulerTypeServices.Update(schedulerType);
     }
     catch (Exception ex)
     {
         Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(ex.Message));
     }
 }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        private void Insert(DirectEventArgs e)
        {
            try
            {
                foreach (var itemRow in chkEmployeeRowSelection.SelectedRows)
                {
                    var model = new GoAboardModel()
                    {
                        RecordId    = Convert.ToInt32(itemRow.RecordID),
                        CreatedBy   = CurrentUser.User.UserName,
                        CreatedDate = DateTime.Now,
                        EditedDate  = DateTime.Now,
                        EditedBy    = CurrentUser.User.UserName,
                    };

                    //edit data
                    EditDataSave(model);

                    //create
                    GoAboardController.Create(model);
                }

                gpGoAboard.Reload();
                ResetForm();
                wdGoAboard.Hide();
            }
            catch (Exception ex)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình tạo: {0}".FormatWith(ex.Message));
            }
        }
示例#4
0
        async Task Load()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Items.Clear();
                var paged = await CategoryService.List();

                Items.ReplaceRange(paged.Items);
            }
            catch (RuleException ex)
            {
                await Dialog.Alert(ex.Message);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                await Dialog.Error();
            }
            finally
            {
                IsBusy = false;
            }
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        private void Insert(DirectEventArgs e)
        {
            try
            {
                foreach (var item in chkEmployeeRowSelection.SelectedRows)
                {
                    var recordId = item.RecordID;
                    var annual   = new AnnualLeaveConfigureModel();
                    EditDataAnnualLeave(annual);
                    annual.RecordId    = Convert.ToInt32(recordId);
                    annual.CreatedDate = DateTime.Now;
                    annual.CreatedBy   = CurrentUser.User.UserName;
                    annual.EditedDate  = DateTime.Now;
                    annual.EditedBy    = CurrentUser.User.UserName;
                    //create
                    AnnualLeaveConfigureController.Create(annual);
                }


                if (e.ExtraParams["Close"] == "True")
                {
                    wdAnnualLeave.Hide();
                    ResetForm();
                }
            }
            catch (Exception ex)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(ex.Message));
            }
        }
 /// <summary>
 ///
 /// </summary>
 private void ReloadGrid()
 {
     try
     {
         if (_timeSheetReport.Status == TimeSheetStatus.Locked)
         {
             Dialog.Alert("Bảng hiệu chỉnh đã khóa. Bạn không được phép thao tác");
             wdTimeSheetAdd.Hide();
             if (btnOpenTimeSheet.Visible)
             {
                 btnOpenTimeSheet.Show();
             }
             if (btnLockTimeSheet.Visible)
             {
                 btnLockTimeSheet.Hide();
             }
         }
         else
         {
             if (btnOpenTimeSheet.Visible)
             {
                 btnOpenTimeSheet.Hide();
             }
             if (btnLockTimeSheet.Visible)
             {
                 btnLockTimeSheet.Show();
             }
         }
         // gridTimeSheet.Reload();
     }
     catch (Exception ex)
     {
         Dialog.ShowError(ex.Message);
     }
 }
示例#7
0
        public static void Main(string[] args)
        {
            using (var nav = new Navigator())
                using (var ctx = new Context())
                    using (var win = new Window(ctx, WindowType.SCREEN_APPLICATION_WINDOW)) {
                        win.AddBuffers(10);
                        win.Identifier = "bla";
                        var r = new Random();
                        foreach (var b in win.Buffers)
                        {
                            b.Fill(r.Next());
                            win.Render(b);
                            System.Threading.Thread.Sleep(200);
                        }
                        //nav.AddUri ("", "Browser", "default", "http://google.com/");
                        //nav.AddUri ("", "Messages", "default", "messages://");
                        //return;

                        var run = true;
                        while (run)
                        {
                            Dialog.Alert("CLOSE ME!", "jpo1jo1j1oj1oj1",
                                         //new Button ("Timer", Timer),
                                         //new Button ("Camera", Cam),
                                         //new Button ("Messages", () => nav.Invoke ("messages://")),
                                         new Button("Badge", () => nav.HasBadge = true),
                                         new Button("Browser", () => nav.Invoke("http://google.com/")),
                                         new Button("Close", () => run = false));
                        }
                    }
        }
示例#8
0
 public static void Cam()
 {
     using (var c = new Camera(Camera.Unit.Front, Camera.Mode.RW)) {
         c.TakePhoto();
     }
     Dialog.Alert("OMFG", "I got camera!1!1", new Button("Ok!"));
 }
示例#9
0
        private void Update()
        {
            try
            {
                if (!string.IsNullOrEmpty(hdfKeyRecord.Text))
                {
                    var userRule = UserRuleTimeSheetServices.GetById(Convert.ToInt32(hdfKeyRecord.Text));
                    if (userRule != null)
                    {
                        if (!string.IsNullOrEmpty(hdfUpdateGroupWorkShift.Text))
                        {
                            userRule.GroupWorkShiftId = Convert.ToInt32(hdfUpdateGroupWorkShift.Text);
                            userRule.EditedDate       = DateTime.Now;
                        }

                        UserRuleTimeSheetServices.Update(userRule);
                    }
                    gridUserRule.Reload();
                }
            }
            catch (Exception ex)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(ex.Message));
            }
        }
示例#10
0
 /// <summary>
 /// update department
 /// </summary>
 private void Update()
 {
     try
     {
         if (int.TryParse(hdfRecordId.Text, out var id) && id > 0)
         {
             var department = cat_DepartmentServices.GetById(id);
             if (department != null)
             {
                 department.Name      = txtName.Text.Trim();
                 department.ShortName = txtShortName.Text.Trim();
                 department.Address   = txtAddress.Text.Trim();
                 department.Telephone = txtTelephone.Text.Trim();
                 department.Fax       = txtFax.Text.Trim();
                 department.TaxCode   = txtTaxCode.Text.Trim();
                 if (int.TryParse(txtOrder.Text, out var order) && order > 0)
                 {
                     department.Order = order;
                 }
                 if (int.TryParse(cbxParent.SelectedItem.Value, out var parentId) && parentId > 0)
                 {
                     department.ParentId = parentId;
                 }
                 department.IsPrimary = chkIsPrimary.Checked;
                 department.IsLocked  = chkIsLocked.Checked;
                 // update
                 cat_DepartmentServices.Update(department);
             }
         }
     }
     catch (Exception e)
     {
         Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(e.Message));
     }
 }
示例#11
0
        /// <summary>
        ///
        /// </summary>
        private void Update()
        {
            try
            {
                if (!int.TryParse(hdfRecordId.Text, out var id))
                {
                    return;
                }
                var model = GoAboardController.GetById(id);
                if (model == null)
                {
                    return;
                }
                //edit data
                EditDataSave(model);
                model.EditedDate = DateTime.Now;
                model.EditedBy   = CurrentUser.User.UserName;

                //update
                GoAboardController.Update(model);
                gpGoAboard.Reload();
                wdGoAboard.Hide();
            }
            catch (Exception e)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(e.Message));
            }
        }
示例#12
0
        /// <summary>
        /// validation
        /// </summary>
        /// <param name="workbook"></param>
        /// <param name="fromRow"></param>
        /// <param name="toRow"></param>
        /// <returns></returns>
        private bool CheckValidation(WorkBook workbook, out int fromRow, out int toRow)
        {
            fromRow        = 2;
            toRow          = 2;
            workbook.Sheet = !txtSheetName.IsEmpty ? workbook.findSheetByName(txtSheetName.Text) : 0;

            if (!txtFromRow.IsEmpty)
            {
                fromRow = Int32.Parse(txtFromRow.Text);
            }

            if (txtToRow.IsEmpty)
            {
                toRow = workbook.LastRow + 1;
            }
            else
            {
                toRow = Int32.Parse(txtToRow.Text);
            }

            if (fromRow < 2)
            {
                Dialog.Alert("Từ hàng lớn hơn 1");
                return(false);
            }

            if (fromRow > toRow || toRow > workbook.LastRow + 1)
            {
                Dialog.Alert("Từ hàng đến hàng không hợp lệ, tệp đính kèm gồm có "
                             + (workbook.LastCol + 1) + " cột và " + (workbook.LastRow + 1) + " hàng.");
                return(false);
            }

            return(true);
        }
示例#13
0
        /// <summary>
        ///
        /// </summary>
        private void Update()
        {
            if (!string.IsNullOrEmpty(hdfKeyRecord.Text))
            {
                DateTime?startTime = null;
                DateTime?endTime   = null;

                var modelTimeSheet       = TimeSheetCodeController.GetById(Convert.ToInt32(hdfKeyRecord.Text));
                var currentTimeSheetCode = string.Empty;

                if (modelTimeSheet != null)
                {
                    modelTimeSheet.EditedDate = DateTime.Now;
                    currentTimeSheetCode      = modelTimeSheet.Code;
                    //Edit data
                    EditData(modelTimeSheet, ref startTime, ref endTime);
                }

                var checkTime = TimeSheetCodeController.GetAll(null, null, null, txtTimeSheetCode.Text, null, true, startTime, endTime, null, null);

                if (checkTime.IsNullOrEmpty() || currentTimeSheetCode == txtTimeSheetCode.Text)
                {
                    TimeSheetCodeController.Update(modelTimeSheet);
                    Dialog.Alert("Cập nhật thành công");
                }
                else
                {
                    Dialog.Alert("Mã chấm công đã tồn tại. Vui lòng nhập mã chấm công khác!");
                    return;
                }
            }
        }
示例#14
0
文件: Main.cs 项目: zendbit/monoberry
        public static void Main(string[] args)
        {
            using (var nav = new Navigator())
                using (var ctx = Context.GetInstance(ContextType.Application)) {
                    nav.OnInvokeResult = (InvokeTargetReply e) => {
                        var info = new StringBuilder();
                        info.AppendLine(String.Format("Id: {0}", e.Id));
                        info.AppendLine(String.Format("Code: {0}", e.Code));
                        info.AppendLine(String.Format("Error Message: {0}", e.ErrorMessage));
                        info.AppendLine(String.Format("Error: {0}", e.Error));
                        var i = e.Invocation;
                        Dialog.Alert("Got InvokeTargetReply", info + "\n\n" + (i == null ? "?" : i.MimeType),
                                     new Button("Quit", () => PlatformServices.Stop()));
                    };

                    using (var req = new InvokeRequest()) {
                        req.Source = "com.burningsoda.monoberry.samples.invocation";
                        req.Action = "bb.action.CAPTURE";
                        req.Target = "sys.camera.card";
                        //req.Data = new System.Text.ASCIIEncoding ().GetBytes ("photo");
                        //req.Action = "";
                        //req.MimeType = "image/jpeg";
                        nav.Invoke(req);
                    }

                    PlatformServices.Run();
                    PlatformServices.Shutdown(0);
                }
        }
        private void Insert(DirectEventArgs e)
        {
            try
            {
                var timeSheet = new hr_TimeSheetRuleEarlyOrLate
                {
                    CreatedDate = DateTime.Now
                };

                EditDataSave(timeSheet);

                hr_TimeSheetRuleEarlyOrLateServices.Create(timeSheet);

                if (e.ExtraParams["Close"] != "True")
                {
                    return;
                }
                wdTimeSheetRule.Hide();
                ResetForm();
            }
            catch (Exception ex)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(ex.Message));
            }
        }
示例#16
0
 /// <summary>
 /// insert new department
 /// </summary>
 private void Insert()
 {
     try
     {
         var department = new cat_Department
         {
             Name      = txtName.Text.Trim(),
             ShortName = txtShortName.Text.Trim(),
             Address   = txtAddress.Text.Trim(),
             Telephone = txtTelephone.Text.Trim(),
             Fax       = txtFax.Text.Trim(),
             TaxCode   = txtTaxCode.Text.Trim(),
             Order     = 0,
             ParentId  = 0,
             IsPrimary = chkIsPrimary.Checked,
             IsLocked  = chkIsLocked.Checked
         };
         if (int.TryParse(cbxParent.SelectedItem.Value, out var parentId) && parentId >= 0)
         {
             department.ParentId = parentId;
         }
         if (int.TryParse(txtOrder.Text, out var order))
         {
             department.Order = order;
         }
         cat_DepartmentServices.Create(department);
     }
     catch (Exception e)
     {
         Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(e.Message));
     }
 }
示例#17
0
        private void Insert()
        {
            try
            {
                var makerPosition     = string.Empty;
                var currentDepartment = string.Empty;
                if (hdfIsMakerPosition.Text == @"0")
                {
                    makerPosition = cbxMakerPosition.Text;
                }
                else
                {
                    makerPosition = cbxMakerPosition.SelectedItem.Text;
                }
                if (hdfIsCurrentDepartment.Text == @"0")
                {
                    currentDepartment = cbxCurrentDepartment.Text;
                }
                else
                {
                    currentDepartment = cbxCurrentDepartment.SelectedItem.Text;
                }

                var business = new hr_BusinessHistory
                {
                    DecisionNumber    = txtDecisionNumber.Text.Trim(),
                    DecisionDate      = dfDecisionDate.SelectedDate,
                    DecisionMaker     = txtDecisionMaker.Text.Trim(),
                    ExpireDate        = dfExpireDate.SelectedDate,
                    ShortDecision     = txtShortDecision.Text,
                    CurrentPosition   = txtCurrentPosition.Text,
                    CurrentDepartment = currentDepartment.TrimStart('-'),
                    DecisionPosition  = makerPosition,
                    BusinessType      = hdfBusinessType.Text,
                    CreatedDate       = DateTime.Now,
                    EditedDate        = DateTime.Now,
                    Description       = txtDescription.Text.Trim()
                };
                if (!string.IsNullOrEmpty(hdfChonCanBo.Text))
                {
                    business.RecordId = int.Parse("0" + hdfChonCanBo.Text);
                }
                // upload file
                var path = string.Empty;
                if (fufTepTinDinhKem.HasFile)
                {
                    string directory = Server.MapPath("../");
                    path = UploadFile(fufTepTinDinhKem, Constant.PathAttachFile);
                }

                business.FileScan = path != "" ? path : hdfTepTinDinhKem.Text;

                hr_BusinessHistoryServices.Create(business);
                gridMoveTo.Reload();
            }
            catch (Exception e)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(e.Message));
            }
        }
示例#18
0
        async public void Login()
        {
            try
            {
                IsBusy = true;

                var model = new LoginModel
                {
                    UserName = UserName,
                    Password = Password
                };

                var result = await IdentityService.Login(model);

                Context.Credentials = result;

                await Navigation.Push <MainViewModel>();
            }
            catch (RuleException ex)
            {
                await Dialog.Alert(ex.Message);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                await Dialog.Error();
            }
            finally
            {
                IsBusy = false;
            }
        }
示例#19
0
        /// <summary>
        ///
        /// </summary>
        private void Update()
        {
            try
            {
                if (string.IsNullOrEmpty(hdfKeyRecord.Text))
                {
                    return;
                }
                var holiday = cat_HolidayServices.GetById(Convert.ToInt32(hdfKeyRecord.Text));
                if (holiday != null)
                {
                    holiday.Name       = txtHolidayName.Text;
                    holiday.Day        = !string.IsNullOrEmpty(txtDay.Text) ? Convert.ToInt32(txtDay.Text) : 0;
                    holiday.Month      = !string.IsNullOrEmpty(txtMonth.Text) ? Convert.ToInt32(txtMonth.Text) : 0;
                    holiday.EditedDate = DateTime.Now;
                    if (!string.IsNullOrEmpty(hdfGroupHoliday.Text))
                    {
                        holiday.Group = hdfGroupHoliday.Text;
                    }
                }

                cat_HolidayServices.Update(holiday);
            }
            catch (Exception ex)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(ex.Message));
            }
        }
示例#20
0
        private void Insert(DirectEventArgs e)
        {
            try
            {
                //check validation choose employee
                if (string.IsNullOrEmpty(e.ExtraParams["ListRecordId"]))
                {
                    ExtNet.Msg.Alert("Thông báo", "Bạn hãy chọn ít nhất 1 cán bộ").Show();
                    return;
                }

                var listId = e.ExtraParams["ListRecordId"].Split(',');
                for (var i = 0; i < listId.Length - 1; i++)
                {
                    var recordId = listId[i];
                    var annual   = new hr_AnnualLeaveConfigure();
                    EditDataAnnualLeave(annual);
                    annual.RecordId    = Convert.ToInt32(recordId);
                    annual.CreatedDate = DateTime.Now;
                    hr_AnnualLeaveConfigureServices.Create(annual);
                }

                if (e.ExtraParams["Close"] == "True")
                {
                    wdAnnualLeave.Hide();
                    ResetForm();
                }
            }
            catch (Exception ex)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(ex.Message));
            }
        }
示例#21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        private void Insert(DirectEventArgs e)
        {
            DateTime?startTime = null;
            DateTime?endTime   = null;

            var modelTimeSheet = new TimeSheetCodeModel(null)
            {
                CreatedDate = DateTime.Now
            };

            //Edit data
            EditData(modelTimeSheet, ref startTime, ref endTime);

            var checkTime = TimeSheetCodeController.GetAll(null, null, null, txtTimeSheetCode.Text, null, true, startTime, endTime, null, null);

            if (checkTime != null && checkTime.Count > 0)
            {
                Dialog.Alert("Mã chấm công đã tồn tại. Vui lòng nhập mã chấm công khác!");
                return;
            }

            TimeSheetCodeController.Create(modelTimeSheet);

            if (e.ExtraParams["Close"] == "True")
            {
                wdTimeSheetCode.Hide();
                ResetForm();
            }
        }
示例#22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnUpdateHL_Click(object sender, DirectEventArgs e)
        {
            try
            {
                foreach (var itemRow in chkEmployeeRowSelection.SelectedRows)
                {
                    var colDynamic = new SalaryBoardDynamicColumnModel
                    {
                        RecordId      = Convert.ToInt32(itemRow.RecordID),
                        ColumnCode    = cbxColumnCode.Text,
                        Display       = txtDisplay.Text,
                        ColumnExcel   = txtColumnExcel.Text,
                        Value         = txtValue.Text,
                        CreatedDate   = DateTime.Now,
                        SalaryBoardId = int.Parse(hdfSalaryBoardListID.Text)
                    };

                    //create
                    SalaryBoardDynamicColumnController.Create(colDynamic);
                }

                //reload
                wdColumnDynamic.Hide();
                gridColumnDynamic.Reload();
            }
            catch (Exception ex)
            {
                Dialog.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra: " + ex.Message);
            }
        }
示例#23
0
        protected void Delete(object sender, DirectEventArgs e)
        {
            try
            {
                foreach (var item in RowSelectionModel1.SelectedRows)
                {
                    int id;
                    if (!int.TryParse(item.RecordID, out id))
                    {
                        continue;
                    }
                    var hs = hr_GoAboardServices.GetById(id);
                    if (hs != null)
                    {
                        hr_GoAboardServices.Delete(hs.Id);
                    }
                }

                grp_HoSoDiNuocNgoai.Reload();
            }
            catch (Exception ex)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình xóa: {0}".FormatWith(ex.Message));
            }
        }
示例#24
0
        /// <summary>
        /// Update
        /// </summary>
        private void Update()
        {
            try
            {
                var makerPosition  = hdfIsUpdateMakerPosition.Text == @"0" ? cbxUpdateMakerPosition.Text : cbxUpdateMakerPosition.SelectedItem.Text;
                var destDepartment = hdfIsUpdateDestDepartment.Text == @"0" ? cbxUpdateDestDepartment.Text : cbxUpdateDestDepartment.SelectedItem.Text;

                if (!int.TryParse(hdfKeyRecord.Text, out var id) || id <= 0)
                {
                    return;
                }
                var business = hr_BusinessHistoryServices.GetById(id);
                var util     = new Util();
                if (business == null)
                {
                    return;
                }
                if (!string.IsNullOrEmpty(hdfRecordId.Text))
                {
                    business.RecordId = Convert.ToInt32(hdfRecordId.Text);
                }
                if (!util.IsDateNull(dfUpdateDecisionDate.SelectedDate))
                {
                    business.DecisionDate = dfUpdateDecisionDate.SelectedDate;
                }
                business.DecisionNumber = txtUpdateDecisionNumber.Text;
                // upload file
                var path = string.Empty;
                if (uploadFileScan.HasFile)
                {
                    // string directory = Server.MapPath("../");
                    path = UploadFile(uploadFileScan, Constant.PathAttachFile);
                }

                business.FileScan = path != "" ? path : hdfTepTinDinhKem.Text;
                if (!util.IsDateNull(dfUpdateEffectiveDate.SelectedDate))
                {
                    business.EffectiveDate = dfUpdateEffectiveDate.SelectedDate;
                }
                business.DecisionMaker         = txtUpdateDecisionMaker.Text;
                business.DecisionPosition      = makerPosition;
                business.CurrentPosition       = txtUpdateCurrentPosition.Text;
                business.CurrentDepartment     = txtUpdateCurrentDepartment.Text;
                business.ShortDecision         = txtUpdateShortDecision.Text;
                business.SourceDepartment      = txtUpdateSourceDepartment.Text;
                business.NewPosition           = txtUpdateNewPosition.Text;
                business.DestinationDepartment = destDepartment.Trim('-');
                business.Description           = txtUpdateDescription.Text;
                business.BusinessType          = hdfBusinessType.Text;
                business.CreatedDate           = DateTime.Now;
                business.EditedDate            = DateTime.Now;

                hr_BusinessHistoryServices.Update(business);
            }
            catch (Exception e)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(e.Message));
            }
        }
示例#25
0
        private void Update()
        {
            try
            {
                int id;
                var util      = new Util();
                var controler = new GoAboardController();
                if (!int.TryParse(hdfRecordId.Text, out id))
                {
                    return;
                }
                var hs = hr_GoAboardServices.GetById(id);
                if (!util.IsDateNull(dfNgayBatDau.SelectedDate))
                {
                    hs.StartDate = dfNgayBatDau.SelectedDate;
                }

                if (!util.IsDateNull(dfNgayKetThuc.SelectedDate))
                {
                    hs.EndDate = dfNgayKetThuc.SelectedDate;
                }

                hs.Note   = txtGhiChu.Text;
                hs.Reason = txtLyDo.Text;
                if (!string.IsNullOrEmpty(hdfNationId.Text))
                {
                    hs.NationId = Convert.ToInt32(hdfNationId.Text);
                }

                hs.DecisionNumber = txtDecisionNumber.Text;
                if (!util.IsDateNull(dfDecisionDate.SelectedDate))
                {
                    hs.DecisionDate = dfDecisionDate.SelectedDate;
                }
                hs.SponsorDepartment = txtSponsorDepartment.Text;
                hs.SourceDepartment  = txtSourceDepartment.Text;
                hs.DecisionMaker     = txtDecisionMaker.Text;
                var makerPosition = string.Empty;
                if (hdfIsMakerPosition.Text == @"0")
                {
                    makerPosition = cbxMakerPosition.Text;
                }
                else
                {
                    makerPosition = cbxMakerPosition.SelectedItem.Text;
                }
                hs.MakerPosition = makerPosition;
                hs.EditedDate    = DateTime.Now;
                controler.Update(hs);
                grp_HoSoDiNuocNgoai.Reload();
                RM.RegisterClientScriptBlock("Grid_Reload", "ReloadGrid();");
            }
            catch (Exception e)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(e.Message));
            }
        }
示例#26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEdit_Click(object sender, DirectEventArgs e)
        {
            try
            {
                string contractId = hdfRecordId.Text;
                if (contractId == "")
                {
                    Dialog.Alert("Thông báo bạn chưa chọn bản ghi nào");
                }
                else
                {
                    var contract = ContractController.GetById(Convert.ToInt32(contractId));
                    var util     = new ConvertUtils();
                    txtHopDongSoHopDong.Text = contract.ContractNumber;
                    cbxContractType.SetValue(contract.ContractTypeId);
                    cbxContractType.Text   = contract.ContractTypeName;
                    hdfContractTypeId.Text = contract.ContractTypeId.ToString();
                    cbxJob.SetValue(contract.JobId);
                    cbxJob.Text      = contract.JobName;
                    hdfCbxJobId.Text = contract.JobId.ToString();
                    if (!util.IsDateNull(contract.ContractEndDate))
                    {
                        dfHopDongNgayKiKet.SetValue(contract.ContractEndDate);
                    }
                    if (!util.IsDateNull(contract.ContractDate))
                    {
                        dfHopDongNgayHopDong.SetValue(contract.ContractDate);
                    }
                    if (!util.IsDateNull(contract.EffectiveDate))
                    {
                        dfNgayCoHieuLuc.SetValue(contract.EffectiveDate);
                    }
                    txt_NguoiKyHD.Text       = contract.PersonRepresent;
                    cbxPosition.Text         = contract.PersonPositionName;
                    hdfContractStatusId.Text = contract.ContractStatusId.ToString();
                    cbxContractStatus.Text   = contract.ContractStatusName;
                    hdfCbxPositionId.Text    = contract.PersonPositionId.ToString();
                    if (!string.IsNullOrEmpty(contract.AttachFileName))
                    {
                        int pos = contract.AttachFileName.LastIndexOf('/');
                        if (pos != -1)
                        {
                            fufHopDongTepTin.Text = contract.AttachFileName.Substring(pos + 1);
                        }

                        hdfHopDongTepTinDK.Text = contract.AttachFileName;
                    }

                    txtHopDongGhiChu.Text = contract.Note;
                    wdHopDong.Show();
                }
            }
            catch (Exception ex)
            {
                Dialog.ShowError(ex.Message);
            }
        }
示例#27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void fileAttachment_FileSelected(object sender, DirectEventArgs e)
 {
     try
     {
     }
     catch (Exception ex)
     {
         Dialog.Alert("Có lỗi xảy ra trong quá trình xử lý {0}".FormatWith(ex.Message));
     }
 }
示例#28
0
        /// <summary>
        ///
        /// </summary>
        private void Update()
        {
            try
            {
                if (!int.TryParse(hdfKeyRecord.Text, out var id) || id <= 0)
                {
                    return;
                }
                var wp = hr_WorkProcessServices.GetById(id);
                if (wp == null)
                {
                    return;
                }
                wp.DecisionNumber = txtCapNhatSoQD.Text.Trim();

                wp.DecisionMaker = txtCapNhatNguoiQD.Text.Trim();
                wp.EffectiveDate = dfCapNhatNgayHieuLuc.SelectedDate;
                wp.CreatedDate   = DateTime.Now;
                wp.EditedDate    = DateTime.Now;
                wp.Note          = txtGhiChuMoi.Text.Trim();
                var util = new Util();
                if (!util.IsDateNull(dfUpdateExpireDate.SelectedDate))
                {
                    wp.ExpireDate = dfUpdateExpireDate.SelectedDate;
                }
                var makerPosition = hdfIsUpdateMakerPosition.Text == @"0"
                    ? cbxUpdateMakerPosition.Text
                    : cbxUpdateMakerPosition.SelectedItem.Text;
                wp.MakerPosition    = makerPosition;
                wp.SourceDepartment = txtUpdateSourceDepartment.Text;
                if (int.TryParse(cbxChucVuMoi.SelectedItem.Value, out var newPositionId) && newPositionId > 0)
                {
                    wp.NewPositionId = newPositionId;
                }

                wp.OldPositionId = !string.IsNullOrEmpty(hdfOldPositionId.Text)
                    ? Convert.ToInt32(hdfOldPositionId.Text)
                    : 0;
                if (int.TryParse(cbxOldDEpartment.SelectedItem.Value, out var oldDepartment))
                {
                    wp.OldDepartmentId = oldDepartment;
                }

                if (!Util.GetInstance().IsDateNull(dfCapNhatNgayQD.SelectedDate))
                {
                    wp.DecisionDate = dfCapNhatNgayQD.SelectedDate;
                }

                hr_WorkProcessServices.Update(wp);
            }
            catch (Exception e)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(e.Message));
            }
        }
示例#29
0
        /// <summary>
        ///
        /// </summary>
        private void Insert()
        {
            try
            {
                var wp = new hr_WorkProcess
                {
                    RecordId         = int.Parse(cbxChonCanBo.SelectedItem.Value),
                    DecisionNumber   = txtSoQDMoi.Text.Trim(),
                    DecisionDate     = dfNgayQDMoi.SelectedDate,
                    DecisionMaker    = txtNguoiQD.Text.Trim(),
                    EffectiveDate    = dfNgayHieuLucMoi.SelectedDate,
                    OldDepartmentId  = 0,
                    NewPositionId    = 0,
                    SourceDepartment = txtSourceDepartment.Text,
                    CreatedDate      = DateTime.Now,
                    EditedDate       = DateTime.Now,
                    Note             = txtGhiChuMoi.Text.Trim()
                };
                var util = new Util();
                if (!util.IsDateNull(dfExpireDate.SelectedDate))
                {
                    wp.ExpireDate = dfExpireDate.SelectedDate;
                }
                var makerPosition = hdfIsMakerPosition.Text == @"0"
                    ? cbxMakerPosition.Text
                    : cbxMakerPosition.SelectedItem.Text;
                wp.MakerPosition = makerPosition;

                // upload file
                var path = string.Empty;
                if (fufTepTinDinhKem.HasFile)
                {
                    var directory = Server.MapPath("../");
                    path = UploadFile(fufTepTinDinhKem, Constant.PathAttachFile);
                }

                wp.AttachFileName = path != "" ? path : hdfTepTinDinhKem.Text;
                if (!string.IsNullOrEmpty(hdfPositionId.Text))
                {
                    wp.NewPositionId = Convert.ToInt32(hdfPositionId.Text);
                }
                if (!string.IsNullOrEmpty(hdfOldPositionId.Text))
                {
                    wp.OldDepartmentId = Convert.ToInt32(hdfOldPositionId.Text);
                }
                hr_WorkProcessServices.Create(wp);
                grp_QuanLyNangNgach.Reload();
            }
            catch (Exception e)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(e.Message));
            }
        }
示例#30
0
        private void Insert(DirectEventArgs e)
        {
            try
            {
                var util      = new Util();
                var startTime = string.Empty;
                var endTime   = string.Empty;

                var timeSheet = new hr_TimeSheetCode()
                {
                    Code        = txtTimeSheetCode.Text,
                    CreatedDate = DateTime.Now,
                };
                if (!string.IsNullOrEmpty(hdfEmployeeSelectedId.Text))
                {
                    timeSheet.RecordId = Convert.ToInt32(hdfEmployeeSelectedId.Text);
                }
                if (!util.IsDateNull(dfStartTime.SelectedDate))
                {
                    timeSheet.StartTime = dfStartTime.SelectedDate;
                    startTime           = dfStartTime.SelectedDate.ToString("yyyy-MM-dd");
                }

                if (!util.IsDateNull(dfEndTime.SelectedDate))
                {
                    timeSheet.EndTime = dfEndTime.SelectedDate;
                    endTime           = dfEndTime.SelectedDate.ToString("yyyy-MM-dd");
                }

                timeSheet.IsActive = chk_IsActive.Checked;
                var checkTime =
                    hr_TimeSheetCodeServices.CheckExitTimeSheetCode(txtTimeSheetCode.Text, startTime, endTime);
                if (checkTime != null && checkTime.Count > 0)
                {
                    Dialog.Alert("Mã chấm công đã tồn tại. Vui lòng nhập mã chấm công khác!");
                    return;
                }
                else
                {
                    hr_TimeSheetCodeServices.Create(timeSheet);
                }

                if (e.ExtraParams["Close"] == "True")
                {
                    wdTimeSheetCode.Hide();
                    ResetForm();
                }
            }
            catch (Exception ex)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(ex.Message));
            }
        }