Exemplo n.º 1
0
        /// <summary>
        /// Init setting window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void InitWindow(object sender, DirectEventArgs e)
        {
            try
            {
                // init id
                var param = e.ExtraParams["Id"];
                // parse id
                if (int.TryParse(param, out var id))
                {
                    // init window props
                    if (id > 0)
                    {
                        // edit
                        wdSetting.Title = @"Sửa";
                        wdSetting.Icon  = Icon.Pencil;
                    }
                    else
                    {
                        // insert
                        wdSetting.Title = @"Thêm mới";
                        wdSetting.Icon  = Icon.Add;
                    }
                    // init id
                    hdfId.Text = id.ToString();

                    // init object
                    var model = new CatalogQuantumModel();

                    // check id
                    if (id > 0)
                    {
                        var result = CatalogQuantumController.GetById(id);
                        if (result != null)
                        {
                            model = result;
                        }
                    }

                    // set catalog props
                    txtName.Text         = model.Name;
                    txtDescription.Text  = model.Description;
                    hdfGroupQuantum.Text = model.GroupQuantumId.ToString();
                    cboGroupQuantum.Text = model.GroupQuantumName;
                    txtOrder.Text        = model.Order.ToString();
                    hdfStatus.Text       = ((int)model.Status).ToString();
                    cboStatus.Text       = model.Status.Description();

                    // show window
                    wdSetting.Show();
                }
            }
            catch (Exception ex)
            {
                // show dilog
                Dialog.ShowError(ex);

                // log exception
                SystemLogController.Create(new SystemLogModel(CurrentUser.User.UserName, "Danh mục ngạch - InitWindow", ex));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Delete catalog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Delete(object sender, DirectEventArgs e)
        {
            try
            {
                // init id
                var param = e.ExtraParams["Id"];

                // parse id
                if (!int.TryParse(param, out var id) || id <= 0)
                {
                    // parse error, show error
                    Dialog.ShowError("Có lỗi xảy ra trong quá trình xử lý");
                    return;
                }

                // delete
                CatalogQuantumController.Delete(id);

                // reload data
                gpCatalog.Reload();
            }
            catch (Exception ex)
            {
                // show dilog
                Dialog.ShowError(ex);

                // log exception
                SystemLogController.Create(new SystemLogModel(CurrentUser.User.UserName, "Danh mục nhóm ngạch - Delete", ex));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        private void EditDataMany(SalaryDecisionModel model)
        {
            var util = new ConvertUtils();

            if (!string.IsNullOrEmpty(hdfPositionMany.Text))
            {
                model.SignerPositionId = Convert.ToInt32(hdfPositionMany.Text);
            }

            model.Name           = txtNameMany.Text;
            model.DecisionNumber = txtDecisionNumberMany.Text;
            if (!util.IsDateNull(dfDecisionDateMany.SelectedDate))
            {
                model.DecisionDate = dfDecisionDateMany.SelectedDate;
            }
            if (!util.IsDateNull(dfEffectiveDateMany.SelectedDate))
            {
                model.EffectiveDate = dfEffectiveDateMany.SelectedDate;
            }
            model.SignerName = txtSignerNameMany.Text;
            model.Note       = txtNoteMany.Text;
            if (!string.IsNullOrEmpty(hdfQuantumIdMany.Text))
            {
                model.QuantumId = Convert.ToInt32(hdfQuantumIdMany.Text);
                var quantum = CatalogQuantumController.GetById(Convert.ToInt32(hdfQuantumIdMany.Text));
                if (quantum != null)
                {
                    model.GroupQuantumId = quantum.GroupQuantumId;
                }
            }

            if (!string.IsNullOrEmpty(hdfSalaryGradeMany.Text))
            {
                model.Grade = Convert.ToInt32(hdfSalaryGradeMany.Text);
            }

            if (!string.IsNullOrEmpty(txtPercentageSalaryMany.Text))
            {
                model.PercentageSalary = Convert.ToDecimal(txtPercentageSalaryMany.Text);
            }
            if (!string.IsNullOrEmpty(txtFactorMany.Text))
            {
                model.Factor = Convert.ToDecimal(txtFactorMany.Text);
            }
            if (!string.IsNullOrEmpty(txtPercentageLeaderMany.Text))
            {
                model.PercentageLeader = Convert.ToDecimal(txtPercentageLeaderMany.Text);
            }
            // upload file
            var path = string.Empty;

            if (fufAttachFileMany.HasFile)
            {
                path = UploadFile(fufAttachFileMany, Constant.PathDecisionSalary);
            }

            model.AttachFileName = path != "" ? path : hdfAttachFileMany.Text;
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void storeSalaryGradeMany_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            if (string.IsNullOrEmpty(hdfQuantumIdMany.Text))
            {
                return;
            }
            var quantum = CatalogQuantumController.GetById(Convert.ToInt32(hdfQuantumIdMany.Text));

            if (quantum == null)
            {
                return;
            }
            var quantumGrade = CatalogGroupQuantumController.GetById(quantum.GroupQuantumId);

            if (quantumGrade == null)
            {
                return;
            }
            var grade = quantumGrade.GradeMax;

            hdfSalaryGradeMany.Text = grade.ToString();
            var comboObjects = new List <ComboObject>();

            for (var i = 1; i <= grade; i++)
            {
                var combo = new ComboObject
                {
                    Code = i.ToString(),
                    Name = "Bậc " + i
                };
                comboObjects.Add(combo);
            }

            storeSalaryGradeMany.DataSource = comboObjects;
            storeSalaryGradeMany.DataBind();
        }
Exemplo n.º 5
0
 public void GetInformationSalaryMany()
 {
     if (!string.IsNullOrEmpty(hdfQuantumIdMany.Text) && !string.IsNullOrEmpty(hdfSalaryGradeMany.Text))
     {
         var quantum = CatalogQuantumController.GetById(Convert.ToInt32(hdfQuantumIdMany.Text));
         if (quantum == null)
         {
             return;
         }
         var groupQuantum = CatalogGroupQuantumGradeController.GetUnique(quantum.GroupQuantumId,
                                                                         Convert.ToInt32(hdfSalaryGradeMany.Text));
         if (groupQuantum == null)
         {
             return;
         }
         txtFactorMany.SetValue(groupQuantum.Factor);
         txtSalaryLevelMany.SetValue(Math.Round(groupQuantum.Factor * Convert.ToDecimal(hdfBasicSalary.Text)).ToString("##,###"));
     }
     else
     {
         txtFactorMany.Text      = @"0";
         txtSalaryLevelMany.Text = @"0";
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Insert or Update Catalog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void InsertOrUpdate(object sender, DirectEventArgs e)
        {
            try
            {
                // init model
                var model = new CatalogQuantumModel
                {
                    EditedBy = CurrentUser.User.UserName
                };

                // check id
                if (!string.IsNullOrEmpty(hdfId.Text) && Convert.ToInt32(hdfId.Text) > 0)
                {
                    var result = CatalogQuantumController.GetById(Convert.ToInt32(hdfId.Text));;
                    if (result != null)
                    {
                        model = result;
                    }
                }

                // set new props for model
                model.Name           = txtName.Text;
                model.Description    = txtDescription.Text;
                model.GroupQuantumId = Convert.ToInt32(hdfGroupQuantum.Text);
                model.Order          = !string.IsNullOrEmpty(txtOrder.Text) ? Convert.ToInt32(txtOrder.Text) : 0;
                model.Status         = !string.IsNullOrEmpty(hdfStatus.Text) ? (CatalogStatus)Convert.ToInt32(hdfStatus.Text) : CatalogStatus.Active;

                // check model id
                if (model.Id > 0)
                {
                    // update
                    CatalogQuantumController.Update(model);

                    // log action
                    SystemLogController.Create(new SystemLogModel(CurrentUser.User.UserName, "Danh mục ngạch", SystemAction.Edit,
                                                                  "Sửa danh mục {0}".FormatWith(model.Name)));
                }
                else
                {
                    // set created user
                    model.CreatedBy = CurrentUser.User.UserName;

                    // insert
                    CatalogQuantumController.Create(model);

                    // log action
                    SystemLogController.Create(new SystemLogModel(CurrentUser.User.UserName, "Danh mục ngạch", SystemAction.Create,
                                                                  "Tạo danh mục {0}".FormatWith(model.Name)));
                }

                // hide window
                wdSetting.Hide();

                // reload data
                gpCatalog.Reload();
            }
            catch (Exception ex)
            {
                // show dilog
                Dialog.ShowError(ex);

                // log exception
                SystemLogController.Create(new SystemLogModel(CurrentUser.User.UserName, "Danh mục nhóm ngạch - InserOrUpdate", ex));
            }
        }