private void SetData(kkslm_ms_discount ds) { AppUtil.BuildCombo(cmbDRole, SlmScr062Biz.GetStaffTypeData(true, ds.slm_StaffTypeId.Value), "กรุณาระบุ"); hdfID.Value = ds.slm_Discount_Id.ToString(); AppUtil.SetComboValue(cmbDRole, ds.slm_StaffTypeId.ToString()); rdoInsuranceType.SelectedIndex = rdoInsuranceType.Items.IndexOf(rdoInsuranceType.Items.FindByValue(ds.slm_InsuranceTypeCode)); #region Add by First 21/11/2559 rdoInsuranceType.Enabled = false; #endregion if (ds.slm_DiscountPercent > 0) { rdoDiscount.SelectedIndex = 0; txtDDiscountValue.Text = ds.slm_DiscountPercent.Value.ToString(); } else if (ds.slm_DiscountBath > 0) { rdoDiscount.SelectedIndex = 1; txtDDiscountValue.Text = ds.slm_DiscountBath.Value.ToString(); } else { rdoDiscount.SelectedIndex = 0; txtDDiscountValue.Text = "0"; } rdoDStatus.SelectedIndex = rdoDStatus.Items.IndexOf(rdoDStatus.Items.FindByValue(ds.is_Deleted.ToString())); cmbDRole.Enabled = false; updModal.Update(); }
private kkslm_ms_discount GetData() { kkslm_ms_discount ds = new kkslm_ms_discount(); ds.slm_Discount_Id = SLMUtil.SafeInt(hdfID.Value); ds.slm_StaffTypeId = SLMUtil.SafeDecimal(cmbDRole.SelectedValue); ds.slm_DiscountBath = rdoDiscount.SelectedValue == "2" ? (decimal?)SLMUtil.SafeDecimal(txtDDiscountValue.Text) : null; ds.slm_DiscountPercent = rdoDiscount.SelectedValue == "1" ? (int?)SLMUtil.SafeInt(txtDDiscountValue.Text) : null; ds.slm_InsuranceTypeCode = rdoInsuranceType.SelectedValue; //ds.slm_ActDiscountBaht = null; //ds.slm_ActDiscountPercent = null; ds.is_Deleted = rdoDStatus.SelectedValue == "True"; return(ds); }