protected void gvUpload_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = gvUpload.Rows[e.RowIndex]; TextBox txtDetailGv = (TextBox)row.FindControl("txtDetailGv"); string _ID = gvUpload.DataKeys[e.RowIndex].Value.ToString(); var _item = this.AttachFiles.Find(l => l.ID_CARD_NO == _ID); if (_item != null) { _item.REMARK = txtDetailGv.Text; } gvUpload.EditIndex = -1; ((DataControlField)gvUpload.Columns .Cast <DataControlField>() .Where(fld => fld.HeaderText == "ดำเนินการ") .SingleOrDefault()).Visible = true; BindDataInGridView(); UpdatePanelUpload.Update(); }
private void BindDataInGridView() { gvUpload.DataSource = this.AttachFiles; gvUpload.DataBind(); UpdatePanelUpload.Update(); }
protected void btnNextGvSearch_Click(object sender, EventArgs e) { NPbutton(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "N", txtTotalPage); BindData(false); Hide_show(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "", txtTotalPage.Text.ToInt()); UpdatePanelUpload.Update(); }
protected void hplDelete_Click(object sender, EventArgs e) { var gr = (GridViewRow)((LinkButton)sender).NamingContainer; Label lblFileGv = (Label)gr.FindControl("lblFileGv"); var list = this.AttachFiles; var _item = list.Find(l => l.ATTACH_FILE_PATH == lblFileGv.Text); list.Remove(_item); var source = Server.MapPath(mapPath + "/" + lblFileGv.Text); FileInfo fiPath = new FileInfo(source); if (fiPath.Exists) { File.Delete(source); } gvUpload.DataSource = list; gvUpload.DataBind(); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; UpdatePanelUpload.Update(); }
private void UploadFile(string fileName) { var list = this.AttachFiles; string userID = this.UserID; string tempFilePath = this.TempFolderOracle; string[] tempFileName = fileName.Split('_'); string masterFileName = tempFileName[1] + "_" + tempFileName[2] + "_" + tempFileName[3]; list.Add(new AttatchFileLicense { ID_ATTACH_FILE = IAS.BLL.Helpers.GenerateIdHelper.GetGenAutoId(), ID_CARD_NO = base.IdCard, ATTACH_FILE_TYPE = ddlTypeAttachment.SelectedValue, ATTACH_FILE_PATH = masterFileName, REMARK = txtDetail.Text, CREATED_BY = userID, CREATED_DATE = DateTime.Now, UPDATED_BY = userID, UPDATED_DATE = DateTime.Now, //FILE_STATUS : String //LICENSE_NO : String //RENEW_TIME : String }); this.AttachFiles = list; BindDataInGridView(); UpdatePanelUpload.Update(); }
protected void gvUpload_RowEditing(object sender, GridViewEditEventArgs e) { gvUpload.EditIndex = e.NewEditIndex; BindDataInGridView(); UpdatePanelUpload.Update(); }
protected void btn_Save_Click(object sender, EventArgs e) { try { if (ddlPlaceGroup.SelectedValue != "") { if (txtSeat.Text.Trim() == "" || txtPlace.Text.Trim() == "" || txtCode.Text.Trim() == "") { UCModalError1.ShowMessageError = "กรุณาระบุข้อมูลให้ครบ"; UCModalError1.ShowModalError(); } else { if (txtSeat.Text.ToInt() > 30000) { UCModalError1.ShowMessageError = "สนามสอบแต่ละแห่งสามารถรองรับผู้สมัครสอบได้สูงสุด 30,000 คน เท่านั้น"; UCModalError1.ShowModalError(); } else { if (txtCode.Text.Length == 5) { Boolean addnew = true; if (txtCode.Enabled == false) { addnew = false; } ExamScheduleBiz biz = new ExamScheduleBiz(); DTO.ResponseMessage <bool> SaveOK = biz.SavePlace(ddlPlaceG.SelectedValue.ToString(), ddlProvince.SelectedValue.ToString(), txtCode.Text, txtPlace.Text, txtSeat.Text, chkFree.Checked, base.UserId.ToString(), addnew, ddlPlaceGroup.SelectedValue.ToString()); if (SaveOK.ResultMessage == true) { UCModalSuccess1.ShowMessageSuccess = SysMessage.SaveSucess; UCModalSuccess1.ShowModalSuccess(); btn_Search_Click(sender, e); btn_Cancle_Click(sender, e); UpdatePanelUpload.Update(); } else { UCModalError1.ShowMessageError = SaveOK.ErrorMsg; UCModalError1.ShowModalError(); } } else { UCModalError1.ShowMessageError = "รหัสสนามสอบต้องมีจำนวน 5 ตัวอักษรเท่านั้น"; UCModalError1.ShowModalError(); } } } } } catch { } }
public void GetAttatchFiles() { var biz = new BLL.PersonBiz(); DTO.ResponseService <DTO.PersonAttatchFile[]> res = biz.GetUserProfileAttatchFileByPersonId(PersonId); var list = res.DataResponse.ToList(); ucAttachFileControl1.AttachFiles = list.ConvertToAttachFilesView(); UpdatePanelUpload.Update(); }
protected void btnImportByIDCard_Click(object sender, EventArgs e) { string dtFromCtrl = string.Empty; string dtFromEnt = string.Empty; string licenseNo = string.Empty; if ((txtImportBirthdayHead.Text == "") || (txtImportLicenseNoHead.Text == "")) { this.MasterPage.ModelError.ShowMessageError = "กรุณาระบุวันเกิดและเลขที่ใบอนุญาต"; this.MasterPage.ModelError.ShowModalError(); return; } else { //BirthDay validate dtFromCtrl = String.Format("{0:dd/MM/yyyy}", txtImportBirthdayHead.Text); dtFromEnt = String.Format("{0:dd/MM/yyyy}", DTO.PersonalT.per.BIRTH_DATE); //License validate List <DTO.PersonLicenseTransaction> lsLicense = this.MasterPage.CompareCurrentLicense(DTO.PersonalT.per.ID_CARD_NO); if (lsLicense.Count > 0) { this.MasterPage.CurrentLicenseByIDCard = lsLicense; DTO.PersonLicenseTransaction cur = lsLicense.FirstOrDefault(lic => lic.LICENSE_NO == txtImportLicenseNoHead.Text); if (cur != null) { licenseNo = this.MasterPage.NullableString(cur.LICENSE_NO); } } if (dtFromCtrl.Equals(dtFromEnt) && (licenseNo == txtImportLicenseNoHead.Text)) { GetPersonalDataToControl(DTO.PersonalT.per); this.MasterPage.SetCurrentLicense(this.ucCurrentLicense); UpdatePanelUpload.Update(); this.MasterPage.UpdatePanelMaster.Update(); this.MasterPage.ImportStatus = "Y"; //Disable Control this.pnlIDCardValidate.Enabled = false; //this.chkEnableEditName.Checked = false; } else { this.MasterPage.ModelError.ShowMessageError = "วันเกิดหรือเลขที่ใบอนุญาตไม่ถูกต้อง"; this.MasterPage.ModelError.ShowModalError(); return; } } }
protected void gvUpload_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { e.Cancel = true; gvUpload.EditIndex = -1; ((DataControlField)gvUpload.Columns .Cast <DataControlField>() .Where(fld => fld.HeaderText == "ดำเนินการ") .SingleOrDefault()).Visible = true; BindDataInGridView(); UpdatePanelUpload.Update(); }
protected void lbtSave_Click(object sender, EventArgs e) { LinkButton lbtUpdate = (LinkButton)((GridViewRow)((LinkButton)sender).Parent.Parent).FindControl("lbtUpdate"); LinkButton lbtSave = (LinkButton)((GridViewRow)((LinkButton)sender).Parent.Parent).FindControl("lbtSave"); LinkButton lbtCancel = (LinkButton)((GridViewRow)((LinkButton)sender).Parent.Parent).FindControl("lbtCancel"); DropDownList ddlQuali = (DropDownList)((GridViewRow)((LinkButton)sender).Parent.Parent).FindControl("ddlQualification"); Label lblname = (Label)((GridViewRow)((LinkButton)sender).Parent.Parent).FindControl("lblName"); Label lblcode = (Label)((GridViewRow)((LinkButton)sender).Parent.Parent).FindControl("lblCode"); if (ddlQuali.SelectedValue == "") { UCModalError1.ShowMessageError = Resources.errorRegisGeneral_001; UCModalError1.ShowModalError(); UpdatePanelUpload.Update(); } else if (lblcode.Text == ddlQuali.SelectedValue) { lblcode.Text = ddlQuali.SelectedValue; lblname.Text = ddlQuali.SelectedItem.Text; lblcode.Visible = true; lblname.Visible = true; ddlQuali.Visible = false; lbtUpdate.Visible = true; lbtSave.Visible = false; lbtCancel.Visible = false; } else if (ListTranSpecial.FirstOrDefault(x => x.SPECIAL_TYPE_CODE == ddlQuali.SelectedValue) == null) { ListTranSpecial.Remove(ListTranSpecial.FirstOrDefault(x => x.SPECIAL_TYPE_CODE == lblcode.Text)); ListTranSpecial.Add(new TranSpecial { SPECIAL_TYPE_CODE = ddlQuali.SelectedValue, SPECIAL_TYPE_DESC = ddlQuali.SelectedItem.Text }); lblcode.Text = ddlQuali.SelectedValue; lblname.Text = ddlQuali.SelectedItem.Text; lblcode.Visible = true; lblname.Visible = true; ddlQuali.Visible = false; lbtUpdate.Visible = true; lbtSave.Visible = false; lbtCancel.Visible = false; } else { UCModalError1.ShowMessageError = Resources.errorRegisGeneral_002; UCModalError1.ShowModalError(); UpdatePanelUpload.Update(); } }
protected void chkCopyAdd_CheckedChanged(object sender, EventArgs e) { //ucAddressCurrent.Clone(ucAddressRegister); //ucAddressRegister = ucAddressCurrent; if (((CheckBox)sender).Checked) { CloneAddress(); ucAddressRegister.Enabled(false); } else { ucAddressRegister.Enabled(true); ucAddressRegister.Clear(); } UpdatePanelUpload.Update(); }
private void EnableControl(Boolean IsEnable) { foreach (Control item in UpdatePanelUpload.Controls[0].Controls) { if (item.GetType() == typeof(TextBox)) { ((TextBox)item).Enabled = IsEnable; } else if (item.GetType() == typeof(DropDownList)) { ((DropDownList)item).Enabled = IsEnable; } else if (item.GetType() == typeof(CheckBox)) { ((CheckBox)item).Enabled = IsEnable; } else if (item.GetType() == typeof(RadioButtonList)) { ((RadioButtonList)item).Enabled = IsEnable; } } chkCopyAdd.Enabled = IsEnable; MasterPage.AttachFileControl.EnableGridView(IsEnable); MasterPage.AttachFileControl.EnableUpload(IsEnable); ucAddressCurrent.Enabled(IsEnable); ucAddressRegister.Enabled(IsEnable); UpdatePanelUpload.Update(); imgPopup_txtBirthDay.Visible = IsEnable; //Get Status after edit data for disable control string Mode = Request.QueryString["Mode"]; if (Mode.Equals("E") && this.Status.Equals(DTO.PersonDataStatus.WaitForApprove.GetEnumValue().ToString())) { MasterPage.AttachFileControl.PnlAttachFiles.Enabled = false; MasterPage.AttachFileControl.EnableUpload(false); MasterPage.PNLAddButton.Visible = true; MasterPage.PNLAddButton.Enabled = false; txtIDNumber.Enabled = false; } else { txtIDNumber.Enabled = false; MasterPage.AttachFileControl.PnlAttachFiles.Enabled = IsEnable; } }
public void OnConfirm(object sender, EventArgs e) { string confirmValue = Request.Form["confirm_value"]; string mystring = confirmValue; string res = mystring.Substring(Math.Max(0, mystring.Length - 1)); if (res == "Y") { //IF say Yes GetPersonalDataToControl(DTO.PersonalT.per); UpdatePanelUpload.Update(); this.MasterPage.UpdatePanelMaster.Update(); } if (res == "N") { //IF say No } }
private void GetAttatchFiles() { ResponseService <RegistrationAttatchFile[]> res; string personID = this.UserProfile.Id; using (BLL.RegistrationBiz biz = new BLL.RegistrationBiz()) { res = biz.GetAttatchFilesByRegisterationID(this.RegisterationID); } List <RegistrationAttatchFile> list = res.DataResponse.ToList(); ucAttachFileControl1.AttachFiles = list.ConvertToAttachFilesView(); UpdatePanelUpload.Update(); }
protected void Hide_show(Button PreName, TextBox txtNum, Button NextName, string N_or_P, int MaxP) { if (txtNum.Text.ToInt() == 1) { PreName.Visible = false; } else { PreName.Visible = true; } UpdatePanelUpload.Update(); if (txtNum.Text.ToInt() == MaxP) { NextName.Visible = false; } else { NextName.Visible = true; } }
private void GetAttatchFiles() { var biz = new BLL.PersonBiz(); string personID = this.UserProfile.Id; DTO.ResponseService <DTO.PersonAttatchFile[]> res = biz.GetUserProfileAttatchFileByPersonId(personID); var list = res.DataResponse.ToList(); if (this.DataAction == DTO.DataActionMode.Edit) { this.PersonAttachFiles = list; } gvUpload.DataSource = list; gvUpload.DataBind(); UpdatePanelUpload.Update(); }
protected void chkCopyAdd_CheckedChanged(object sender, EventArgs e) { //ucAddressCurrent.Clone(ucAddressRegister); //ucAddressRegister = ucAddressCurrent; if (((CheckBox)sender).Checked) { CloneAddress(); //ucAddressRegister.Enabled(false); } else { ucAddressRegister.Enabled(true); ucAddressRegister.DropdownProvince.SelectedIndex = 0; ucAddressRegister.DropdownDistrict.Items.Clear(); ucAddressRegister.DropdownParish.Items.Clear(); ucAddressRegister.Address = ucAddressCurrent.Address; ucAddressRegister.PostCode = ucAddressCurrent.PostCode; ucAddressRegister.Clear(); } UpdatePanelUpload.Update(); }
private void EnableControl(Boolean IsEnable) { foreach (Control item in UpdatePanelUpload.Controls[0].Controls) { if (item.GetType() == typeof(TextBox)) { ((TextBox)item).Enabled = IsEnable; } else if (item.GetType() == typeof(DropDownList)) { ((DropDownList)item).Enabled = IsEnable; } else if (item.GetType() == typeof(CheckBox)) { ((CheckBox)item).Enabled = IsEnable; } else if (item.GetType() == typeof(RadioButtonList)) { ((RadioButtonList)item).Enabled = IsEnable; } } chkCopyAdd.Enabled = IsEnable; ucAddressCurrent.Enabled(IsEnable); ucAddressRegister.Enabled(IsEnable); UpdatePanelUpload.Update(); //Get Status after edit data for disable control ResponseService <Registration> res; using (BLL.RegistrationBiz biz = new BLL.RegistrationBiz()) { //?? //res = biz.GetById(this.MasterPage.UserProfile.Id); res = biz.GetById(this.MasterPage.RegistrationId); } string Mode = Request.QueryString["Mode"]; if (Mode.Equals("E") && res.DataResponse.STATUS.Equals(DTO.RegistrationStatus.NotApprove.GetEnumValue().ToString())) { //txtBirthDay.ReadOnly = true; //Edited by Nattapong because of can't get the value while ReadOnly Session["Status"] = this.MasterPage.NullableString(res.DataResponse.STATUS); txtIDNumber.Enabled = false; MasterPage.PNLAddButton.Visible = true; MasterPage.PNLAddButton.Enabled = true; txtEmail.Enabled = false; this.MasterPage.AttachFileControl.EnableGridView(true); this.MasterPage.AttachFileControl.EnableUpload(true); this.pnlIDCardValidate.Enabled = false; } else if (Mode.Equals("E") && res.DataResponse.STATUS.Equals(DTO.RegistrationStatus.WaitForApprove.GetEnumValue().ToString())) { txtBirthDay.ReadOnly = true; Session["Status"] = this.MasterPage.NullableString(res.DataResponse.STATUS); txtIDNumber.Enabled = false; MasterPage.PNLAddButton.Visible = false; MasterPage.PNLAddButton.Enabled = false; txtEmail.Enabled = false; this.MasterPage.AttachFileControl.EnableGridView(false); this.MasterPage.AttachFileControl.EnableUpload(false); //this.chkEnableEditName.Enabled = false; this.pnlIDCardValidate.Enabled = false; } else { txtBirthDay.ReadOnly = true; Session["Status"] = this.MasterPage.NullableString(res.DataResponse.STATUS); txtIDNumber.Enabled = IsEnable; txtEmail.Enabled = IsEnable; this.MasterPage.AttachFileControl.EnableGridView(false); this.MasterPage.AttachFileControl.EnableUpload(false); this.pnlIDCardValidate.Enabled = false; } this.MasterPage.GetCurrentLicense(this.ucCurrentLicense, res.DataResponse.ID_CARD_NO); }
protected void btnUploadFile_Click(object sender, EventArgs e) { string tempFileName = Path.GetFileName(fulFile.PostedFile.FileName); bool invalid = validateFileType(tempFileName); if (ddlRequestLicenseType.SelectedIndex != 0) { if (ddlTypeAttachment.SelectedIndex != 0) { if (tempFileName != string.Empty) { FileInfo f = new FileInfo(tempFileName); string surNameFile = f.Extension; string fileName = string.Empty; var TypeFile = AttachFiles.Where(w => w.ATTACH_FILE_TYPE == ddlTypeAttachment.SelectedValue).FirstOrDefault(); string yearMonthDay = DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); string hourMinSec = DateTime.Now.ToString("HHmmss", System.Globalization.CultureInfo.InvariantCulture); DirectoryInfo DirInfo = new DirectoryInfo(Server.MapPath(mapPath) + this.TempFolderOracle); if (invalid) { if (UserProfile.IdCard != string.Empty) { var attFileImage = this.GetDocumentTypeIsImage.Where(w => w.Id == ddlTypeAttachment.SelectedValue).FirstOrDefault(); if (attFileImage != null) { if (TypeFile == null) { tempFileName = "_" + UserProfile.IdCard + "_" + ddlRequestLicenseType.SelectedValue + surNameFile; UploadFileImage(tempFileName); string[] _fileName = tempFileName.Split('_'); string masterFileName = _fileName[1] + "_" + _fileName[2]; //*** Create Folder ***// if (!DirInfo.Exists) { DirInfo.Create(); fulFile.PostedFile.SaveAs(Server.MapPath(mapPath + "/" + this.TempFolderOracle + "/" + masterFileName)); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } else { fulFile.PostedFile.SaveAs(Server.MapPath(mapPath + "/" + this.TempFolderOracle + "/" + masterFileName)); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } } else { UCModalError.ShowMessageError = SysMessage.PleaseDeleteFile; UCModalError.ShowModalError(); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } } else { //Upload File Normal if (TypeFile == null) { tempFileName = "_" + UserProfile.IdCard + "_" + ddlRequestLicenseType.SelectedValue + "_" + ddlTypeAttachment.SelectedValue + surNameFile; UploadFile(tempFileName); string[] _fileName = tempFileName.Split('_'); string masterFileName = _fileName[1] + "_" + _fileName[2] + "_" + _fileName[3]; //*** Create Folder ***// if (!DirInfo.Exists) { DirInfo.Create(); fulFile.PostedFile.SaveAs(Server.MapPath(mapPath + "/" + this.TempFolderOracle + "/" + masterFileName)); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } else { fulFile.PostedFile.SaveAs(Server.MapPath(mapPath + "/" + this.TempFolderOracle + "/" + masterFileName)); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } } else { tempFileName = "_" + UserProfile.IdCard + "_" + ddlTypeAttachment.SelectedValue + "_" + yearMonthDay + hourMinSec + surNameFile; UploadFile(tempFileName); string[] _fileName = tempFileName.Split('_'); string masterFileName = _fileName[1] + "_" + _fileName[2] + "_" + _fileName[3]; //*** Create Folder ***// if (!DirInfo.Exists) { DirInfo.Create(); fulFile.PostedFile.SaveAs(Server.MapPath(mapPath + "/" + this.TempFolderOracle + "/" + masterFileName)); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } else { fulFile.PostedFile.SaveAs(Server.MapPath(mapPath + "/" + this.TempFolderOracle + "/" + masterFileName)); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } //UCModalError.ShowMessageError = SysMessage.PleaseSelectFile; //UCModalError.ShowModalError(); UCModalError.ShowMessageError = SysMessage.PleaseDeleteFile; UCModalError.ShowModalError(); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } } } else { UCModalError.ShowMessageError = SysMessage.PleaseInputIDNumber; UCModalError.ShowModalError(); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } } else { //UCModalError.ShowMessageError = SysMessage.PleaseSelectFile; //UCModalError.ShowModalError(); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } } else { UCModalError.ShowMessageError = SysMessage.PleaseChooseFile; UCModalError.ShowModalError(); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } } else { UCModalError.ShowMessageError = SysMessage.PleaseSelectFile; UCModalError.ShowModalError(); ddlTypeAttachment.SelectedIndex = 0; txtDetail.Text = string.Empty; } UpdatePanelUpload.Update(); } else { } }