/// <summary> /// Edited by Nattapong @15/7/2557 /// added RegistrationApprove() && RegistrationNotApprove() /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOk_Click(object sender, EventArgs e) { BLL.RegistrationBiz biz = new BLL.RegistrationBiz(); BLL.PersonBiz bizPerson = new BLL.PersonBiz(); //var detail = biz.GetRegistrationsByCriteria(txtFirstNameAfterReg.Text, txtLastNameAfterReg.Text, null, null, txtIDNumberAfterReg.Text, null, txtEmailAfterReg.Text, null, null, 1, 20, "2"); var detail = biz.GetRegistrationsByCriteria(txtFirstNameAfterReg.Text, txtLastNameAfterReg.Text, null, null, txtIDNumberAfterReg.Text, null, txtEmailAfterReg.Text, null, Session["RegStatus"].ToString(), 1, 20, "2"); DataSet ds = detail.DataResponse; #region Get MemberType From Control @Nattapong //string RegMemType = string.Empty; //if (txtTypeMemberAfterReg.Text != "") //{ // switch (txtTypeMemberAfterReg.Text) // { // case "บุคคลทั่วไป": // RegMemType = Convert.ToString((int)DTO.MemberType.General.GetEnumValue()); // break; // case "บุคคลทั่วไป/ตัวแทน/นายหน้า": // RegMemType = Convert.ToString((int)DTO.MemberType.General.GetEnumValue()); // break; // case "บุคคลทั่วไป (ตัวแทน/นายหน้า)/ตัวแทน/นายหน้า": // RegMemType = Convert.ToString((int)DTO.MemberType.General.GetEnumValue()); // break; // case "บริษัทประกัน": // RegMemType = Convert.ToString((int)DTO.MemberType.Insurance.GetEnumValue()); // break; // case "บริษัท": // RegMemType = Convert.ToString((int)DTO.MemberType.Insurance.GetEnumValue()); // break; // case "สมาคม": // RegMemType = Convert.ToString((int)DTO.MemberType.Association.GetEnumValue()); // break; // } //} #endregion if (ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; var id = dt.AsEnumerable().Select(s => s.Field <string>("ID")); List <string> ls = new List <string>(); for (int i = 0; i < dt.Rows.Count; i++) { string strID = Convert.ToString(dt.Rows[0]["ID"]); ls.Add(strID); } if (ddlStatusApproval.SelectedValue.Equals("2")) { string userid = UserProfile.Id; var res = biz.RegistrationApprove(ls, txtResultReg.Text, userid, this.MemberTypeSession); if (res.IsError) { UCModalError.ShowMessageError = res.ErrorMsg; UCModalError.ShowModalError(); } else { string AlertSussuss = String.Format("alert('{0}');window.location.assign('../Register/regSearchOfficerOIC.aspx?Back=R')", SysMessage.SaveSucess); ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", AlertSussuss, true); } } else if (ddlStatusApproval.SelectedValue.Equals("3")) { string userid = UserProfile.Id; var res = biz.RegistrationNotApprove(ls, txtResultReg.Text.ToString(), userid); if (res.IsError) { UCModalError.ShowMessageError = res.ErrorMsg; UCModalError.ShowModalError(); } else { string AlertSussuss = String.Format("alert('{0}');window.location.assign('../Register/regSearchOfficerOIC.aspx?Back=R')", SysMessage.SaveSucess); ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", AlertSussuss, true); } } else if (ddlStatusApproval.SelectedValue.Equals("5")) { var res = bizPerson.PersonApprove(ls); if (res.IsError) { UCModalError.ShowMessageError = res.ErrorMsg; UCModalError.ShowModalError(); } else { string AlertSussuss = String.Format("alert('{0}');window.location.assign('../Register/regSearchOfficerOIC.aspx?Back=R')", SysMessage.SaveSucess); ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", AlertSussuss, true); } } else if (ddlStatusApproval.SelectedValue.Equals("6")) { var res = bizPerson.PersonNotApprove(ls); if (res.IsError) { UCModalError.ShowMessageError = res.ErrorMsg; UCModalError.ShowModalError(); } else { string AlertSussuss = String.Format("alert('{0}');window.location.assign('../Register/regSearchOfficerOIC.aspx?Back=R')", SysMessage.SaveSucess); ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", AlertSussuss, true); } } else if (ddlStatusApproval.SelectedValue.Equals("")) { UCModalError.ShowMessageError = Resources.errorEdit_Reg_Person_004; UCModalError.ShowModalError(); } } }