Esempio n. 1
0
        protected void imbEdit_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
//                var branch = BranchBiz.GetBranch(((ImageButton)sender).CommandArgument);
                var branch = BranchBiz.GetBranchNew(((ImageButton)sender).CommandArgument);
                if (branch != null)
                {
                    trIdInfo.Visible = true;
                    BuildUpperBranchEdit(branch.BranchCode);
                    cbEdit.Checked                = true;
                    txtBranchCodePopup.Text       = branch.BranchCodeNew;
                    txtBranchCodePopup.Enabled    = false;
                    txtBranchCodeIdPopup.Text     = branch.BranchCode;
                    txtBranchCodeIdPopup.Enabled  = false;
                    txtBranchNamePopup.Text       = branch.BranchName;
                    cmbChannelPopup.SelectedIndex = cmbChannelPopup.Items.IndexOf(cmbChannelPopup.Items.FindByValue(branch.ChannelId));
                    txtWorkStartHourPopup.Text    = branch.StartTimeHour;
                    txtWorkStartMinPopup.Text     = branch.StartTimeMinute;
                    txtWorkEndHourPopup.Text      = branch.EndTimeHour;
                    txtWorkEndMinPopup.Text       = branch.EndTimeMinute;

                    if (!string.IsNullOrEmpty(branch.UpperBranch))
                    {
                        cmbUpperBranchPopup.SelectedIndex =
                            cmbUpperBranchPopup.Items.IndexOf(cmbUpperBranchPopup.Items.FindByValue(branch.UpperBranch.Trim()));
                    }
                    rbActive.Checked   = branch.Status == "Y" ? true : false;
                    rbInActive.Checked = branch.Status == "Y" ? false : true;

                    // address
                    cmbProvince.SelectedIndex = cmbProvince.Items.IndexOf(cmbProvince.Items.FindByValue(branch.slm_ProvinceId.ToString()));
                    BuildAmphur();
                    cmbAmphur.SelectedIndex = cmbAmphur.Items.IndexOf(cmbAmphur.Items.FindByValue(branch.slm_AmphurId.ToString()));
                    BuildTambol();
                    cmbTambol.SelectedIndex = cmbTambol.Items.IndexOf(cmbTambol.Items.FindByValue(branch.slm_TambolId.ToString()));
                    txtAddressNo.Text       = branch.slm_House_No;
                    txtMoo.Text             = branch.slm_Moo;
                    txtBuilding.Text        = branch.slm_Building;
                    txtFloor.Text           = branch.slm_Village;
                    txtLane.Text            = branch.slm_Soi;
                    txtStreet.Text          = branch.slm_Street;
                    txtZipCode.Text         = branch.slm_Zipcode;

                    upPopup.Update();
                    mpePopup.Show();
                }
                else
                {
                    throw new Exception("ไม่พบรหัสสาขา " + ((ImageButton)sender).CommandArgument + " ในระบบ");
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }