Exemple #1
0
        void Page_PreRenderComplete(object sender, EventArgs e)
        {
            if (!this.Enabled)
            {
                fileUpload.Visible = false;
            }
            else
            {
                fileUpload.Visible = true;
                string path   = this.Page.ResolveUrl("~");
                string cookie = this.Page.Request.Cookies[FormsAuthentication.FormsCookieName] == null ? string.Empty : this.Page.Request.Cookies[FormsAuthentication.FormsCookieName].Value;

                string script = @"
    var UploadifyAuthCookie = '" + this.Page.Server.UrlEncode(cookie) + @"';
    var UploadifySessionId = '" + this.Page.Server.UrlEncode(this.Page.Session.SessionID) + @"';

    $(""#" + fileUpload.ClientID + @""").uploadify({
        'swf': '" + path + @"scripts/uploadify.swf',
        'cancelImg': '" + path + @"scripts/uploadify-cancel.png',
        'buttonText': 'Incarca...',
        'uploader': '" + path + @"handlers/Upload.ashx?filePath=" + this.Page.Server.UrlEncode(this.FilePath) + @"&storage=" + this.UploadTo + @"',
        'multi': false,
        'formData': { 'RequireUploadifySessionSync': true, 'SecurityToken': UploadifyAuthCookie, 'SessionId': UploadifySessionId }, 
        'auto': true,
        'onUploadComplete' : function(file) {
            $(""#" + fileNameHidden.ClientID + @""").val(file.name);
            $(""#" + hiddenCommand.ClientID + @""").click();
        }
    });
    ";

                ToolkitScriptManager.RegisterClientScriptBlock(this, typeof(Uploader2), this.ID, script, true);
            }
        }
    protected void BtnNew_Click(object sender, EventArgs e)
    {
        txtUserFullName.ReadOnly     = false;
        txtUserOrganization.ReadOnly = false;
        txtUserTitle.ReadOnly        = false;
        txtUsername.ReadOnly         = false;
        txtUserMail.ReadOnly         = false;
        txtUserPhone.ReadOnly        = false;
        txtUserAddress.ReadOnly      = false;
        txtUserNote.ReadOnly         = false;

        txtUserFullName.Text     = string.Empty;
        txtUserOrganization.Text = string.Empty;
        txtUserTitle.Text        = string.Empty;
        txtUsername.Text         = string.Empty;
        txtUserMail.Text         = string.Empty;
        txtUserPhone.Text        = string.Empty;
        txtUserAddress.Text      = string.Empty;
        ddlUserActif.Text        = string.Empty;
        txtUserNote.Text         = string.Empty;

        BtnSave.Text = "Save";
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.Append(@"<script type='text/javascript'>");
        sb.Append("$('#addEdiModal').modal('show');");
        sb.Append(@"</script>");
        ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "addEdiModalScript", sb.ToString(), false);
        upEdit.Update();
    }
Exemple #3
0
        protected void LinkButtonDelete_Click(Object sender, EventArgs e)
        {
            var gv = (GridViewRow)((LinkButton)sender).NamingContainer;
            //gv.Cells[0].Visible = true;
            string strNo = ((Label)gv.Cells[0].Controls[0]).Text;

            BLL.DataCenterBiz biz      = new BLL.DataCenterBiz();
            DTO.UserProfile   profiles = (DTO.UserProfile)HttpContext.Current.Session[PageList.UserProfile];
            string            Alert    = "confirm('" + Resources.infoSettingAttach_001 + "')";

            ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "confirm", Alert, true);
            var res = biz.DeleteConfigDocument(Convert.ToInt16(strNo), profiles);

            if (res.IsError)
            {
                UCModalError.ShowMessageError = res.ErrorMsg;
                UCModalError.ShowModalError();
            }
            else
            {
                UCModalSuccess.ShowMessageSuccess = SysMessage.DeleteConfigLicense;
                UCModalSuccess.ShowModalSuccess();
                UpdatePanelGrid.Update();
            }
        }
Exemple #4
0
        void Command()
        {
            string script = @"function uploadComplete() { document.getElementById('" + hiddenCommand.ClientID + "').click(); }";

            ToolkitScriptManager.RegisterClientScriptBlock(this, typeof(Uploader), "command on upload", script, true);

            uploader.OnClientUploadComplete = "uploadComplete";
        }
Exemple #5
0
        private void Redirect()
        {
            string url    = this.Page.Request.Url.ToString();
            string script = @"function uploadComplete() { window.location.href = '" + url + @"'; }";

            ToolkitScriptManager.RegisterClientScriptBlock(this, typeof(Uploader), "redirect on upload", script, true);

            uploader.OnClientUploadComplete = "uploadComplete";
        }
 protected void BtnUnsubscribe_Click(object sender, EventArgs e)
 {
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     sb.Append(@"<script type='text/javascript'>");
     sb.Append("$('#deleteModal').modal('show');");
     sb.Append(@"</script>");
     ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DeleteModalScript", sb.ToString(), false);
     upDel.Update();
 }
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        try
        {
            string motif = string.Empty;

            string strmsg = "";
            objModulesPage.ModulesPageID   = 0;
            objModulesPage.PageName        = txtPageName.Text.Trim();
            objModulesPage.ModuleID        = int.Parse(ddlModule.SelectedValue);
            objModulesPage.PageUrl         = txtPageUrl.Text.Trim();
            objModulesPage.PageDescription = txtPageDescription.Text.Trim();

            if (BtnSave.Text.ToUpper() == "Save".ToUpper())
            {
                objModulesPage.SaveModulesPage(objModulesPage, out strmsg);
                if (this.global_error.Visible)
                {
                    this.global_error.Visible = false;
                }
                this.global_success.Visible  = true;
                this.global_success_msg.Text = "The Page is successfully saved into the system.";
                UpdatePanel.Update();
            }


            else if (BtnSave.Text.ToUpper() == "UPDATE".ToUpper())
            {
                var i = int.Parse(Session[RunningCache.ModulesPageID].ToString());
                objModulesPage.ModulesPageID = int.Parse(Session[RunningCache.ModulesPageID].ToString());
                objModulesPage.UpdateModulesPage(objModulesPage, out strmsg);
                this.global_success.Visible  = true;
                this.global_success_msg.Text = "The Page is successfully updated into the system.";
                UpdatePanel.Update();
            }

            upCrudGrid.Update();
            bindgrid();
        }

        catch (Exception ex)
        {
        }


        sb.Append(@"<script type='text/javascript'>");

        sb.Append("$('#addEdiModal').modal('hide');");

        sb.Append(@"</script>");

        ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript", sb.ToString(), false);
    }
    protected void EntGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            int index = Convert.ToInt32(e.CommandArgument) % EntGridView.PageSize;

            string HDnID = ((HiddenField)EntGridView.Rows[index].FindControl("ModulesPageID")).Value;

            string ModuleName      = ((Label)EntGridView.Rows[index].FindControl("ModuleName")).Text;
            string PageName        = ((Label)EntGridView.Rows[index].FindControl("PageName")).Text;
            string PageUrl         = ((Label)EntGridView.Rows[index].FindControl("PageUrl")).Text;
            string PageDescription = ((Label)EntGridView.Rows[index].FindControl("PageDescription")).Text;

            Session[RunningCache.ModulesPageID] = HDnID;

            if (e.CommandName.Equals("view"))
            {
                try
                {
                    bindModule();

                    DataTable dtModule = objModules.GetModules(" where ModuleName='" + ModuleName + "'");
                    ddlModule.SelectedValue = dtModule.Rows[0]["ModuleID"].ToString();
                    txtPageName.Text        = PageName;
                    txtPageUrl.Text         = PageUrl;
                    txtPageDescription.Text = PageDescription;

                    BtnSave.Text = "Update";
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("$('#addEdiModal').modal('show');");
                    sb.Append(@"</script>");
                    ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "addEdiModalScript", sb.ToString(), false);
                    upEdit.Update();
                }
                catch (Exception ex)
                {
                }
            }

            if (e.CommandName.Equals("deleting"))
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#deleteModal').modal('show');");
                sb.Append(@"</script>");
                ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DeleteModalScript", sb.ToString(), false);
                upDel.Update();
            }
        }
        catch (Exception ex)
        {
        }
    }
Exemple #9
0
 protected void BtnNew_Click(object sender, EventArgs e)
 {
     txtAreaInterestName.Text        = string.Empty;
     txtAreaInterestDescription.Text = string.Empty;
     BtnSave.Text = "Save";
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     sb.Append(@"<script type='text/javascript'>");
     sb.Append("$('#addEdiModal').modal('show');");
     sb.Append(@"</script>");
     ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "addEdiModalScript", sb.ToString(), false);
     upEdit.Update();
 }
    protected void BtnDelete_Click(object sender, EventArgs e)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        try
        {
            if (!(objInterest.DeleteInterest(Session[RunningCache.InterestID].ToString())))
            {
                if (this.global_success.Visible)
                {
                    this.global_success.Visible = false;
                }
                this.global_error.Visible  = true;
                this.global_error_msg.Text = Mains.Constant.FAIL_CRUD;
                UpdAdd.Update();
                upCrudGrid.Update();
                upDel.Update();
                bindgrid();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#deleteModal').modal('hide');");
                sb.Append(@"</script>");
                ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "delHideModalScript", sb.ToString(), false);
                return;
            }

            else
            {
                if (this.global_error.Visible)
                {
                    this.global_error.Visible = false;
                }
                this.global_success.Visible  = true;
                this.global_success_msg.Text = Mains.Constant.SUCCESS_DELETE;
                UpdAdd.Update();
                upDel.Update();
                upCrudGrid.Update();
                bindgrid();
            }
        }

        catch (Exception ex)
        {
        }

        sb.Append(@"<script type='text/javascript'>");

        sb.Append("$('#deleteModal').modal('hide');");

        sb.Append(@"</script>");

        ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "delHideModalScript", sb.ToString(), false);
    }
Exemple #11
0
        protected override void OnPreRender(EventArgs e)
        {
            string script    = "";
            string parts     = "";
            string firstPart = null;

            foreach (TableRow row in base.Table.Rows)
            {
                foreach (TableCell cell in row.Cells)
                {
                    WebPart webPart     = null;
                    string  containerID = this.CreateContainerID(cell.ID);
                    if (base.ContainersParts.ContainsKey(containerID))
                    {
                        webPart = base.WebParts[base.ContainersParts[containerID]];
                        if (String.IsNullOrEmpty(firstPart))
                        {
                            firstPart = webPart.ID;
                        }
                    }
                    if (null != webPart)
                    {
                        parts += "'" + containerID + "',";
                    }
                }
            }
            if (!String.IsNullOrEmpty(parts))
            {
                parts = parts.Substring(0, parts.LastIndexOf(","));
            }

            if (String.IsNullOrEmpty(this.ActiveWebPart))
            {
                this.ActiveWebPart = firstPart;
            }

            if (!String.IsNullOrEmpty(parts))
            {
                script += "var tabs = [" + parts + "];  \n";
                script += "function Toggle(id){  \n";
                script += "    for(i = 0; i < tabs.length; i++) \n";
                script += "        document.getElementById(tabs[i]).className = 'tabzone_inactivetab';  \n";
                script += "    document.getElementById(id).className = 'tablezone_container'; \n";
                script += "}    \n";
                ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "toggle tabs", script, true);
            }

            base.OnPreRender(e);
        }
Exemple #12
0
    protected void EntGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            int index = Convert.ToInt32(e.CommandArgument) % EntGridView.PageSize;
            //DataTable dtt = new DataTable();
            string HDnID                   = ((HiddenField)EntGridView.Rows[index].FindControl("AreaInterestID")).Value;
            string AreaInterestName        = ((Label)EntGridView.Rows[index].FindControl("AreaInterestName")).Text;
            string AreaInterestDescription = ((Label)EntGridView.Rows[index].FindControl("AreaInterestDescription")).Text;
            Session[RunningCache.AreaInterestID] = HDnID;

            if (e.CommandName.Equals("view"))
            {
                try
                {
                    txtAreaInterestName.Text        = AreaInterestName;
                    txtAreaInterestDescription.Text = AreaInterestDescription;
                    BtnSave.Text = "Update";
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("$('#addEdiModal').modal('show');");
                    sb.Append(@"</script>");
                    ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "addEdiModalScript", sb.ToString(), false);
                    upEdit.Update();
                }
                catch (Exception ex)
                {
                }
            }

            if (e.CommandName.Equals("deleting"))
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#deleteModal').modal('show');");
                sb.Append(@"</script>");
                ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DeleteModalScript", sb.ToString(), false);
                upDel.Update();
            }
        }
        catch (Exception ex)
        {
        }
    }
Exemple #13
0
    protected void Toolbar1_ButtonClicked(object sender, ButtonEventArgs e)
    {
        switch (e.CommandName)
        {
        case "save":
            try
            {
                Save();
            }
            finally
            {
                if (!Page.ClientScript.IsClientScriptBlockRegistered("closeWatingModal"))
                {
                    ToolkitScriptManager.RegisterClientScriptBlock(this.Container, this.Container.GetType(), "closeWatingModal", "closeWaitingModal();", true);
                }
            }
            break;

        case "query":
            try
            {
                Query();
            }
            finally
            {
                if (!Page.ClientScript.IsClientScriptBlockRegistered("closeWatingModal"))
                {
                    ToolkitScriptManager.RegisterClientScriptBlock(this.Container, this.Container.GetType(), "closeWatingModal", "closeWaitingModal();", true);
                }
            }
            break;

        case "return":
            Response.Redirect("StocktakeReqList.aspx");
            break;

        default:
            break;
        }
    }
    protected void EntGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            int    index = Convert.ToInt32(e.CommandArgument) % EntGridView.PageSize;
            string HDnID = ((HiddenField)EntGridView.Rows[index].FindControl("FocalPointsID")).Value;
            string SectorInterestName       = ((Label)EntGridView.Rows[index].FindControl("SectorInterestName")).Text;
            string AreaInterestName         = ((Label)EntGridView.Rows[index].FindControl("AreaInterestName")).Text;
            string UserMail                 = ((Label)EntGridView.Rows[index].FindControl("UserMail")).Text;
            string FocalPointsNotifications = ((Label)EntGridView.Rows[index].FindControl("FocalPointsNotifications")).Text;
            Session[RunningCache.FocalPointsID] = HDnID;

            if (e.CommandName.Equals("view"))
            {
                try
                {
                    bindSectorInterest();
                    bindAreaInterest();

                    DataTable dtSector = objSectorInterest.GetSectorInterest(" where SectorInterestName='" + SectorInterestName + "'");
                    if (dtSector.Rows.Count > 0)
                    {
                        ddlSectorInterest.SelectedValue = dtSector.Rows[0]["SectorInterestID"].ToString();
                    }

                    DataTable dtArea = objAreaInterest.GetAreaInterest(" where AreaInterestName='" + AreaInterestName + "'");
                    if (dtArea.Rows.Count > 0)
                    {
                        ddlAreaInterest.SelectedValue = dtArea.Rows[0]["AreaInterestID"].ToString();
                    }

                    DataTable dtUsers = objUsers.GetUsers(" where UserMail='" + UserMail + "'");
                    if (dtUsers.Rows.Count > 0)
                    {
                        ddlUsers.SelectedValue = dtUsers.Rows[0]["UserID"].ToString();
                    }

                    if (FocalPointsNotifications == "No")
                    {
                        RadioButtonNo.Checked = true;
                    }
                    else if (FocalPointsNotifications == "Yes")
                    {
                        RadioButtonYes.Checked = true;
                    }

                    BtnSave.Text = "Update";
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("$('#addEdiModal').modal('show');");
                    sb.Append(@"</script>");
                    ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "addEdiModalScript", sb.ToString(), false);
                    upEdit.Update();
                }
                catch (Exception ex)
                {
                }
            }

            if (e.CommandName.Equals("deleting"))
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#deleteModal').modal('show');");
                sb.Append(@"</script>");
                ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DeleteModalScript", sb.ToString(), false);
                upDel.Update();
            }
        }
        catch (Exception ex)
        {
        }
    }
Exemple #15
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            BLL.RegistrationBiz biz       = new BLL.RegistrationBiz();
            BLL.PersonBiz       bizPerson = new BLL.PersonBiz();

            var     detail = biz.GetRegistrationsByCriteria(txtFirstName.Text, txtLastName.Text, null, null, txtIDNumber.Text, null, txtEmail.Text, null, Session["RegStatus"].ToString(), 1, 20, "2");
            DataSet ds     = detail.DataResponse;

            #region Get MemberType From Control @Nattapong
            string RegMemType = string.Empty;
            if (txtMemberType.Text != "")
            {
                switch (txtMemberType.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.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[i]["ID"]);
                    ls.Add(strID);
                }

                if (ddlStatusApproval.SelectedValue.Equals("2"))
                {
                    //var res = biz.RegistrationApprove(ls, "อนุมัติกลุ่ม");
                    string userid = UserProfile.Id;
                    var    res    = biz.RegistrationApprove(ls, txtResultReg.Text, userid, RegMemType);
                    if (res.IsError)
                    {
                        UCModalError1.ShowMessageError = res.ErrorMsg;
                        UCModalError1.ShowModalError();
                    }
                    else
                    {
                        //UCModalSuccess.ShowMessageSuccess = "ทำรายการเรียบร้อย";
                        //UCModalSuccess.ShowModalSuccess();
                        ////Response.Redirect("~/Register/regSearchOfficerOIC.aspx");
                        //btnOk.Enabled = false;
                        //btnCancel.Text = "ย้อนกลับ";
                        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;
                    string userid = Session["PersonalIDCard"].ToString();
                    var    res    = biz.RegistrationNotApprove(ls, txtResultReg.Text.ToString(), userid);
                    if (res.IsError)
                    {
                        UCModalError1.ShowMessageError = res.ErrorMsg;
                        UCModalError1.ShowModalError();
                    }
                    else
                    {
                        //UCModalSuccess.ShowMessageSuccess = "ทำรายการเรียบร้อย";
                        //UCModalSuccess.ShowModalSuccess();
                        ////Response.Redirect("~/Register/regSearchOfficerOIC.aspx");
                        //btnOk.Enabled = false;
                        //btnCancel.Text = "ย้อนกลับ";
                        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(""))
                {
                    UCModalError1.ShowMessageError = Resources.errorEdit_Reg_Person_004;
                    UCModalError1.ShowModalError();
                }
            }
        }
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        try
        {
            DataTable dtSubscriber = objSubscriber.GetSubscriber(" where SubscriberEmail=" + txtSubEmail.Text + " and InterestStatus=true and InterestSector=" + ddlSectorInterest.SelectedValue + " and InterestArea=" + ddlAreaInterest.SelectedValue);
            if (dtSubscriber.Rows.Count > 0)
            {
                if (this.global_error.Visible)
                {
                    this.global_error.Visible = false;
                }
                this.global_success.Visible  = true;
                this.global_success_msg.Text = "This subscription already exist in the Contact List.";
                UpdAdd.Update();
                upEdit.Update();
            }
            else
            {
                string motif = string.Empty;

                string strmsg = "";
                objInterest.InterestID         = 0;
                objInterest.InterestSector     = int.Parse(ddlSectorInterest.SelectedValue);
                objInterest.InterestArea       = int.Parse(ddlAreaInterest.SelectedValue);
                objInterest.InterestSubscriber = int.Parse(Session[RunningCache.SubscriberID].ToString());
                objInterest.LastModifiedBy     = 0;
                objInterest.LastModifiedDate   = DateTime.Now;
                if (BtnSave.Text.ToUpper() == "Save".ToUpper())
                {
                    objInterest.SaveInterest(objInterest, out strmsg);
                    if (this.global_error.Visible)
                    {
                        this.global_error.Visible = false;
                    }
                    this.global_success.Visible  = true;
                    this.global_success_msg.Text = "The Interest is successfully saved into the system.";
                    UpdAdd.Update();
                }


                else if (BtnSave.Text.ToUpper() == "UPDATE".ToUpper())
                {
                    objInterest.InterestID = int.Parse(Session[RunningCache.InterestID].ToString());
                    objInterest.UpdateInterest(objInterest, out strmsg);
                    this.global_success.Visible  = true;
                    this.global_success_msg.Text = "The Interest is successfully updated into the system.";
                    UpdAdd.Update();
                }
            }

            upCrudGrid.Update();
            bindgrid();
            filldataSubscriber(dtSubscriber.Rows[0]["SubscriberEmail"].ToString(), dtSubscriber.Rows[0]["SubscriberCode"].ToString());
        }

        catch (Exception ex)
        {
        }


        sb.Append(@"<script type='text/javascript'>");

        sb.Append("$('#addEdiModal').modal('hide');");

        sb.Append(@"</script>");

        ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript", sb.ToString(), false);
    }
    protected void EntGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            int    index = Convert.ToInt32(e.CommandArgument) % EntGridView.PageSize;
            string HDnID = ((HiddenField)EntGridView.Rows[index].FindControl("InterestID")).Value;
            string SectorInterestName = ((Label)EntGridView.Rows[index].FindControl("SectorInterestName")).Text;
            string AreaInterestName   = ((Label)EntGridView.Rows[index].FindControl("AreaInterestName")).Text;

            Session[RunningCache.InterestID] = HDnID;

            if (e.CommandName.Equals("view"))
            {
                try
                {
                    bindSectorInterest();
                    bindAreaInterest();
                    DataTable dtInterest = objInterest.GetInterest(" where InterestID='" + HDnID + "'");
                    ddlSectorInterest1.SelectedValue = dtInterest.Rows[0]["InterestSector"].ToString();
                    ddlAreaInterest1.SelectedValue   = dtInterest.Rows[0]["InterestArea"].ToString();
                    BtnSave.Text = "Update";
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("$('#addEdiModal').modal('show');");
                    sb.Append(@"</script>");
                    ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "addEdiModalScript", sb.ToString(), false);
                    upEdit.Update();
                }
                catch (Exception ex)
                {
                }
            }

            if (e.CommandName.Equals("deleting"))
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                try
                {
                    if (!(objInterest.DeleteInterest(Session[RunningCache.InterestID].ToString())))
                    {
                        if (this.global_success.Visible)
                        {
                            this.global_success.Visible = false;
                        }
                        this.global_error.Visible  = true;
                        this.global_error_msg.Text = Mains.Constant.FAIL_CRUD;
                        UpdAdd.Update();
                        upCrudGrid.Update();
                        upDel.Update();
                        bindgrid();

                        return;
                    }

                    else
                    {
                        if (this.global_error.Visible)
                        {
                            this.global_error.Visible = false;
                        }
                        this.global_success.Visible  = true;
                        this.global_success_msg.Text = Mains.Constant.SUCCESS_DELETE;
                        UpdAdd.Update();
                        upDel.Update();
                        upCrudGrid.Update();
                        bindgrid();
                    }
                }

                catch (Exception ex)
                {
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
        protected void btnOkEdit_Click(object sender, EventArgs e)
        {
            //บุคคลธรรมดา
            if (this.UserProfile.MemberType.ToString() == DTO.MemberType.General.GetEnumValue().ToString())
            {
                if (!ValidDateInput())
                {
                    return;
                }

                Registration item = new Registration();

                //var attachFiles = this.AttachFiles;
                //var personAttachFiles = this.PersonAttachFiles;

                item.ID = this.RegisterationID;

                item.MEMBER_TYPE = this.MememberTypeGuest;

                item.ID_CARD_NO          = txtIDNumber.Text;
                item.PRE_NAME_CODE       = ddlTitle.SelectedValue;
                item.NAMES               = txtFirstName.Text;
                item.LASTNAME            = txtLastName.Text;
                item.ID_CARD_NO          = txtIDNumber.Text;
                item.BIRTH_DATE          = Convert.ToDateTime(txtBirthDay.Text);
                item.SEX                 = rblSex.SelectedValue;
                item.NATIONALITY         = ddlNationality.SelectedValue;
                item.EDUCATION_CODE      = ddlEducation.SelectedValue;
                item.EMAIL               = txtEmail.Text;
                item.LOCAL_TELEPHONE     = txtTel.Text;
                item.TELEPHONE           = txtMobilePhone.Text;
                item.ADDRESS_1           = UcCurrentAdd.TextBoxAddress.Text;
                item.PROVINCE_CODE       = UcCurrentAdd.DropdownProvince.SelectedValue;
                item.AREA_CODE           = UcCurrentAdd.DropdownDistrict.SelectedValue;
                item.TUMBON_CODE         = UcCurrentAdd.DropdownParish.SelectedValue;
                item.ZIP_CODE            = UcCurrentAdd.TextBoxPostCode.Text;
                item.LOCAL_ADDRESS1      = UcRegisAdd.TextBoxAddress.Text;
                item.LOCAL_PROVINCE_CODE = UcRegisAdd.DropdownProvince.SelectedValue;
                item.LOCAL_AREA_CODE     = UcRegisAdd.DropdownDistrict.SelectedValue;
                item.LOCAL_TUMBON_CODE   = UcRegisAdd.DropdownParish.SelectedValue;
                item.LOCAL_ZIPCODE       = UcRegisAdd.TextBoxPostCode.Text;
                item.UPDATED_BY          = this.UserID;
                item.UPDATED_DATE        = DateTime.Now;
                item.STATUS              = "1";

                if (item != null)
                {
                    BLL.RegistrationBiz biz = new BLL.RegistrationBiz();

                    var result = biz.ValidateBeforeSubmit(DTO.RegistrationType.General, item);

                    if (result.IsError)
                    {
                        UCModalError.ShowMessageError = result.ErrorMsg;
                        UCModalError.ShowModalError();
                    }
                    else
                    {
                        if (this.DataAction == DTO.DataActionMode.Edit)
                        {
                            try
                            {
                                var res = biz.Update(item, ucAttachFileControl1.AttachFiles.ConvertToRegistrationAttachFiles().ToList());

                                if (res.IsError)
                                {
                                    UCModalError.ShowMessageError = res.ErrorMsg;
                                    UCModalError.ShowModalError();
                                }
                                else
                                {
                                    Session.Remove("AttatchFiles");

                                    Session.Abandon();

                                    ClearControl();

                                    UCModalError.Visible   = false;
                                    UCModalSuccess.Visible = false;
                                    BLL.DataCenterBiz dbiz = new BLL.DataCenterBiz();
                                    var r = dbiz.GetConfigApproveMember();
                                    foreach (var items in r.DataResponse)
                                    {
                                        if (items.Id == "01" && items.Value == "Y")
                                        {
                                            string AlertWaitingForApprove = "alert('" + Resources.infoSysMessage_EditSuccess + "');window.location.assign('../home.aspx')";
                                            ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", AlertWaitingForApprove, true);
                                        }
                                    }
                                    string Alert = "alert('" + Resources.infoSysMessage_RegisSuccess2 + "');window.location.assign('../home.aspx')";
                                    ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", Alert, true);
                                }
                            }
                            catch (Exception ex)
                            {
                                UCModalError.ShowMessageError = ex.Message;
                                UCModalError.ShowModalError();
                            }
                        }
                    }
                }
            }
            //บริษัท ยังไม่แยก Methodเฉพาะ > var result = biz.ValidateBeforeSubmit(DTO.RegistrationType.Insurance, item);
            else if (this.UserProfile.MemberType.ToString() == DTO.MemberType.Insurance.GetEnumValue().ToString())
            {
                //if (!ValidDateInput())
                //{
                //    return;
                //}

                Registration item = new Registration();

                //var attachFiles = this.AttachFiles;
                //var personAttachFiles = this.PersonAttachFiles;

                item.COMP_CODE = this.UserProfile.CompCode;

                item.ID = this.RegisterationID;

                item.MEMBER_TYPE = this.MememberTypeGuest;

                item.ID_CARD_NO    = txtIDNumber.Text;
                item.PRE_NAME_CODE = ddlTitle.SelectedValue;
                item.NAMES         = txtFirstName.Text;
                item.LASTNAME      = txtLastName.Text;
                item.ID_CARD_NO    = txtIDNumber.Text;
                //item.BIRTH_DATE = Convert.ToDateTime(txtBirthDay.Text);
                item.SEX         = rblSex.SelectedValue;
                item.NATIONALITY = ddlNationality.SelectedValue;
                //item.EDUCATION_CODE = ddlEducation.SelectedValue;
                item.EMAIL           = txtEmail.Text;
                item.LOCAL_TELEPHONE = txtTel.Text;
                item.TELEPHONE       = txtMobilePhone.Text;
                item.ADDRESS_1       = UcCurrentAdd.TextBoxAddress.Text;
                item.PROVINCE_CODE   = UcCurrentAdd.DropdownProvince.SelectedValue;
                item.AREA_CODE       = UcCurrentAdd.DropdownDistrict.SelectedValue;
                item.TUMBON_CODE     = UcCurrentAdd.DropdownParish.SelectedValue;
                item.ZIP_CODE        = UcCurrentAdd.TextBoxPostCode.Text;
                //item.LOCAL_ADDRESS1 = txtRegisterAddress.Text;
                //item.LOCAL_PROVINCE_CODE = UcRegisAdd.DropdownProvince.SelectedValue;
                //item.LOCAL_AREA_CODE = UcRegisAdd.DropdownDistrict.SelectedValue;
                //item.LOCAL_TUMBON_CODE = UcRegisAdd.DropdownParish.SelectedValue;
                //item.LOCAL_ZIPCODE = txtPostcodeRegisterAddress.Text;
                item.UPDATED_BY   = this.UserID;
                item.UPDATED_DATE = DateTime.Now;
                item.STATUS       = DTO.RegistrationStatus.WaitForApprove.GetEnumValue().ToString();

                if (item != null)
                {
                    BLL.RegistrationBiz biz = new BLL.RegistrationBiz();

                    var result = biz.ValidateBeforeSubmit(DTO.RegistrationType.General, item);

                    if (result.IsError)
                    {
                        UCModalError.ShowMessageError = result.ErrorMsg;
                        UCModalError.ShowModalError();
                    }
                    else
                    {
                        if (this.DataAction == DTO.DataActionMode.Edit)
                        {
                            try
                            {
                                var res = biz.Update(item, ucAttachFileControl1.AttachFiles.ConvertToRegistrationAttachFiles().ToList());

                                if (res.IsError)
                                {
                                    UCModalError.ShowMessageError = res.ErrorMsg;
                                    UCModalError.ShowModalError();
                                }
                                else
                                {
                                    Session.Remove("AttatchFiles");

                                    Session.Abandon();

                                    ClearControl();

                                    UCModalError.Visible   = false;
                                    UCModalSuccess.Visible = false;
                                    BLL.DataCenterBiz dbiz = new BLL.DataCenterBiz();
                                    var r = dbiz.GetConfigApproveMember();
                                    foreach (var items in r.DataResponse)
                                    {
                                        if (items.Id == "01" && items.Value == "Y")
                                        {
                                            string AlertWaitingForApprove = "alert('" + Resources.infoSysMessage_EditSuccess + "');window.location.assign('../home.aspx')";
                                            ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", AlertWaitingForApprove, true);
                                        }
                                    }
                                    string Alert = "alert('" + Resources.infoSysMessage_RegisSuccess2 + "');window.location.assign('../home.aspx')";
                                    ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", Alert, true);
                                }
                            }
                            catch (Exception ex)
                            {
                                UCModalError.ShowMessageError = ex.Message;
                                UCModalError.ShowModalError();
                            }
                        }
                    }
                }
                else
                {
                    UCModalError.ShowMessageError = SysMessage.TryAgain;
                    UCModalError.ShowModalError();
                }
            }
            //สมาคม ยังไม่แยก Methodเฉพาะ > var result = biz.ValidateBeforeSubmit(DTO.RegistrationType.Association, item);
            else if (this.UserProfile.MemberType.ToString() == DTO.MemberType.Association.GetEnumValue().ToString())
            {
                //if (!ValidDateInput())
                //{
                //    return;
                //}

                Registration item = new Registration();

                //var attachFiles = this.AttachFiles;
                //var personAttachFiles = this.PersonAttachFiles;

                item.ID = this.RegisterationID;

                item.MEMBER_TYPE = this.MememberTypeGuest;

                item.ID_CARD_NO    = txtIDNumber.Text;
                item.PRE_NAME_CODE = ddlTitle.SelectedValue;
                item.NAMES         = txtFirstName.Text;
                item.LASTNAME      = txtLastName.Text;
                item.ID_CARD_NO    = txtIDNumber.Text;
                //item.BIRTH_DATE = Convert.ToDateTime(txtBirthDay.Text);
                item.SEX         = rblSex.SelectedValue;
                item.NATIONALITY = ddlNationality.SelectedValue;
                //item.EDUCATION_CODE = ddlEducation.SelectedValue;
                item.EMAIL           = txtEmail.Text;
                item.LOCAL_TELEPHONE = txtTel.Text;
                item.TELEPHONE       = txtMobilePhone.Text;
                item.ADDRESS_1       = UcCurrentAdd.TextBoxAddress.Text;
                item.PROVINCE_CODE   = UcCurrentAdd.DropdownProvince.SelectedValue;
                item.AREA_CODE       = UcCurrentAdd.DropdownDistrict.SelectedValue;
                item.TUMBON_CODE     = UcCurrentAdd.DropdownParish.SelectedValue;
                item.ZIP_CODE        = UcCurrentAdd.TextBoxPostCode.Text;
                //item.LOCAL_ADDRESS1 = txtRegisterAddress.Text;
                //item.LOCAL_PROVINCE_CODE = UcRegisAdd.DropdownProvince.SelectedValue;
                //item.LOCAL_AREA_CODE = UcRegisAdd.DropdownDistrict.SelectedValue;
                //item.LOCAL_TUMBON_CODE = UcRegisAdd.DropdownParish.SelectedValue;
                //item.LOCAL_ZIPCODE = txtPostcodeRegisterAddress.Text;
                item.UPDATED_BY   = this.UserID;
                item.UPDATED_DATE = DateTime.Now;
                item.STATUS       = DTO.RegistrationStatus.WaitForApprove.GetEnumValue().ToString();

                if (item != null)
                {
                    BLL.RegistrationBiz biz = new BLL.RegistrationBiz();

                    var result = biz.ValidateBeforeSubmit(DTO.RegistrationType.General, item);

                    if (result.IsError)
                    {
                        UCModalError.ShowMessageError = result.ErrorMsg;
                        UCModalError.ShowModalError();
                    }
                    else
                    {
                        if (this.DataAction == DTO.DataActionMode.Edit)
                        {
                            try
                            {
                                var res = biz.Update(item, ucAttachFileControl1.AttachFiles.ConvertToRegistrationAttachFiles().ToList());

                                if (res.IsError)
                                {
                                    UCModalError.ShowMessageError = res.ErrorMsg;
                                    UCModalError.ShowModalError();
                                }
                                else
                                {
                                    Session.Remove("AttatchFiles");

                                    Session.Abandon();

                                    ClearControl();

                                    UCModalError.Visible   = false;
                                    UCModalSuccess.Visible = false;
                                    BLL.DataCenterBiz dbiz = new BLL.DataCenterBiz();
                                    var r = dbiz.GetConfigApproveMember();
                                    foreach (var items in r.DataResponse)
                                    {
                                        if (items.Id == "01" && items.Value == "Y")
                                        {
                                            string AlertWaitingForApprove = "alert('" + Resources.infoSysMessage_EditSuccess + "');window.location.assign('../home.aspx')";
                                            ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", AlertWaitingForApprove, true);
                                        }
                                    }
                                    string Alert = "alert('" + Resources.infoSysMessage_RegisSuccess2 + "');window.location.assign('../home.aspx')";
                                    ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", Alert, true);
                                }
                            }
                            catch (Exception ex)
                            {
                                UCModalError.ShowMessageError = ex.Message;
                                UCModalError.ShowModalError();
                            }
                        }
                    }
                }
                else
                {
                    UCModalError.ShowMessageError = SysMessage.TryAgain;
                    UCModalError.ShowModalError();
                }
            }
            else
            {
                UCModalError.ShowMessageError = SysMessage.TryAgain;
                UCModalError.ShowModalError();
            }
        }
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        try
        {
            if (!string.IsNullOrEmpty(txtUserMail.Text.Trim()) && IsValid(txtUserMail.Text.Trim()))
            {
                string motif = string.Empty;

                string strmsg = "";

                objUsers.UserID = 0;

                objUsers.UserFullName     = txtUserFullName.Text.Trim();
                objUsers.UserOrganization = txtUserOrganization.Text.Trim();
                objUsers.UserTitle        = txtUserTitle.Text.Trim();
                objUsers.Username         = txtUsername.Text.Trim();
                objUsers.UserMail         = txtUserMail.Text.Trim();
                objUsers.UserPhone        = txtUserPhone.Text.Trim();
                objUsers.UserAddress      = txtUserAddress.Text.Trim();
                objUsers.UserProfile      = int.Parse(ddlProfile.SelectedValue);
                if (int.Parse(ddlUserActif.SelectedValue) == 1)
                {
                    objUsers.UserActif = true;
                }
                else
                {
                    objUsers.UserActif = false;
                }

                string Newpwd = GetUniqueKey(6);
                objUsers.UserPassword     = Newpwd;
                objUsers.UserNote         = txtUserNote.Text.Trim();
                objUsers.LastModifiedBy   = int.Parse(Session[RunningCache.UserID].ToString());
                objUsers.LastModifiedDate = DateTime.Now;

                if (BtnSave.Text.ToUpper() == "Save".ToUpper())
                {
                    DataTable dtUser = objUsers.GetUsers(" where Username='******'");
                    if (dtUser.Rows.Count > 0)
                    {
                        if (this.global_success.Visible)
                        {
                            this.global_success.Visible = false;
                        }
                        this.global_error.Visible  = true;
                        this.global_error_msg.Text = "This username already exist in our system. Please choose another one.";
                        UpdatePanel.Update();
                    }
                    else
                    {
                        objUsers.SaveUsers(objUsers, out strmsg);
                        if (this.global_error.Visible)
                        {
                            this.global_error.Visible = false;
                        }
                        this.global_success.Visible  = true;
                        this.global_success_msg.Text = "The user is successfully saved into the system.";
                        UpdatePanel.Update();
                        SendEmail(txtUserMail.Text.Trim(), "ContactHub Login Details", txtUserFullName.Text.Trim(), txtUsername.Text.Trim(), objUsers.UserPassword);
                        SendEmail("*****@*****.**", "ContactHub Login Details", txtUserFullName.Text.Trim(), txtUsername.Text.Trim(), objUsers.UserPassword);
                    }
                }


                else if (BtnSave.Text.ToUpper() == "UPDATE".ToUpper())
                {
                    objUsers.UserID = int.Parse(HDnIDUserID.ToString());
                    objUsers.AdminUpdateUsers(objUsers, out strmsg);
                    if (this.global_error.Visible)
                    {
                        this.global_error.Visible = false;
                    }
                    this.global_success.Visible  = true;
                    this.global_success_msg.Text = "The user is successfully updated into the system.";
                    UpdatePanel.Update();
                }

                upCrudGrid.Update();
                bindgrid();
            }
            else
            {
                if (this.global_success.Visible)
                {
                    this.global_success.Visible = false;
                }
                this.global_error.Visible  = true;
                this.global_error_msg.Text = "Please enter a valid email.";
                UpdatePanel.Update();
            }
        }

        catch (Exception ex)
        {
        }

        sb.Append(@"<script type='text/javascript'>");

        sb.Append("$('#addEdiModal').modal('hide');");

        sb.Append(@"</script>");

        ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript", sb.ToString(), false);
    }
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        try
        {
            string motif = string.Empty;

            string strmsg = "";
            objFocalPoints.FocalPointsID     = 0;
            objFocalPoints.FocalPointsUser   = int.Parse(ddlUsers.SelectedValue);
            objFocalPoints.FocalPointsSector = int.Parse(ddlSectorInterest.SelectedValue);
            objFocalPoints.FocalPointsArea   = int.Parse(ddlAreaInterest.SelectedValue);
            objFocalPoints.LastModifiedBy    = int.Parse(Session[RunningCache.UserID].ToString());
            objFocalPoints.LastModifiedDate  = DateTime.Now;
            if (RadioButtonYes.Checked == true)
            {
                objFocalPoints.FocalPointsNotification = true;
            }
            else if (RadioButtonNo.Checked == true)
            {
                objFocalPoints.FocalPointsNotification = false;
            }

            if (BtnSave.Text.ToUpper() == "Save".ToUpper())
            {
                DataTable dtFP = objFocalPoints.GetFocalPoints(" where FocalPointsUser="******" and FocalPointsSector=" + int.Parse(ddlSectorInterest.SelectedValue) + " and FocalPointsArea=" + int.Parse(ddlAreaInterest.SelectedValue));
                if (dtFP.Rows.Count > 0)
                {
                    if (this.global_success.Visible)
                    {
                        this.global_success.Visible = false;
                    }
                    this.global_error.Visible  = true;
                    this.global_error_msg.Text = " This user is already a Focal Point for the Sector and Area selected";
                    UpdatePanel.Update();


                    UpdatePanel.Update();
                }
                else
                {
                    objFocalPoints.SaveFocalPoints(objFocalPoints, out strmsg);
                    if (this.global_error.Visible)
                    {
                        this.global_error.Visible = false;
                    }
                    this.global_success.Visible  = true;
                    this.global_success_msg.Text = "The Focal Point is successfully saved into the system.";
                    UpdatePanel.Update();
                }
            }


            else if (BtnSave.Text.ToUpper() == "UPDATE".ToUpper())
            {
                objFocalPoints.FocalPointsID = int.Parse(Session[RunningCache.FocalPointsID].ToString());
                objFocalPoints.UpdateFocalPoints(objFocalPoints, out strmsg);
                this.global_success.Visible  = true;
                this.global_success_msg.Text = "The Focal Point is successfully updated into the system.";
                UpdatePanel.Update();
            }

            upCrudGrid.Update();
            bindgrid();
        }

        catch (Exception ex)
        {
        }


        sb.Append(@"<script type='text/javascript'>");

        sb.Append("$('#addEdiModal').modal('hide');");

        sb.Append(@"</script>");

        ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript", sb.ToString(), false);
    }
Exemple #21
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        try
        {
            string motif = string.Empty;

            string strmsg = "";
            objAreaInterest.AreaInterestID          = 0;
            objAreaInterest.AreaInterestName        = txtAreaInterestName.Text.Trim();
            objAreaInterest.AreaInterestDescription = txtAreaInterestDescription.Text.Trim();
            objAreaInterest.LastModifiedBy          = int.Parse(Session[RunningCache.UserID].ToString());
            objAreaInterest.LastModifiedDate        = DateTime.Now;

            if (BtnSave.Text.ToUpper() == "Save".ToUpper())
            {
                DataTable dtArea = objAreaInterest.GetAreaInterest(" where AreaInterestName='" + txtAreaInterestName.Text.Trim() + "'");
                if (dtArea.Rows.Count > 0)
                {
                    if (this.global_success.Visible)
                    {
                        this.global_success.Visible = false;
                    }
                    this.global_error.Visible  = true;
                    this.global_error_msg.Text = txtAreaInterestName.Text.Trim() + " already exist in the database";
                    UpdatePanel.Update();
                }
                else
                {
                    objAreaInterest.SaveAreaInterest(objAreaInterest, out strmsg);
                    if (this.global_error.Visible)
                    {
                        this.global_error.Visible = false;
                    }
                    this.global_success.Visible  = true;
                    this.global_success_msg.Text = "The area of interest is successfully saved into the system.";
                    UpdatePanel.Update();
                }
            }


            else if (BtnSave.Text.ToUpper() == "UPDATE".ToUpper())
            {
                objAreaInterest.AreaInterestID = int.Parse(Session[RunningCache.AreaInterestID].ToString());
                objAreaInterest.UpdateAreaInterest(objAreaInterest, out strmsg);
                this.global_success.Visible  = true;
                this.global_success_msg.Text = "The area of interest is successfully updated into the system.";
                UpdatePanel.Update();
            }

            upCrudGrid.Update();
            bindgrid();
        }

        catch (Exception ex)
        {
        }


        sb.Append(@"<script type='text/javascript'>");

        sb.Append("$('#addEdiModal').modal('hide');");

        sb.Append(@"</script>");

        ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript", sb.ToString(), false);
    }
        protected void btnOkSubmit_Click(object sender, EventArgs e)
        {
            var    biz      = new BLL.PersonBiz();
            string personID = this.PersonID;
            var    res      = biz.GetPersonTemp(personID);
            string userid   = UserProfile.Id;

            PersonTemp item = new PersonTemp();

            if (res.DataResponse != null)
            {
                item.ID              = res.DataResponse.ID;
                item.MEMBER_TYPE     = res.DataResponse.MEMBER_TYPE;
                item.COMP_CODE       = res.DataResponse.COMP_CODE;
                item.PRE_NAME_CODE   = res.DataResponse.PRE_NAME_CODE;
                item.NAMES           = res.DataResponse.NAMES;
                item.LASTNAME        = res.DataResponse.LASTNAME;
                item.SEX             = res.DataResponse.SEX;
                item.ID_CARD_NO      = res.DataResponse.ID_CARD_NO;
                item.BIRTH_DATE      = res.DataResponse.BIRTH_DATE;
                item.EDUCATION_CODE  = res.DataResponse.EDUCATION_CODE;
                item.NATIONALITY     = res.DataResponse.NATIONALITY;
                item.EMAIL           = res.DataResponse.EMAIL;
                item.LOCAL_TELEPHONE = res.DataResponse.LOCAL_TELEPHONE;
                item.TELEPHONE       = res.DataResponse.TELEPHONE;

                //ขาด 2 ตัว
                //txtIDOicBeforeReg.Text =
                //txtIDMemberNumberAfterReg.Text =
                //ขาด 2 ตัว

                item.ADDRESS_1           = res.DataResponse.ADDRESS_1;
                item.PROVINCE_CODE       = res.DataResponse.PROVINCE_CODE;
                item.AREA_CODE           = res.DataResponse.AREA_CODE;
                item.TUMBON_CODE         = res.DataResponse.TUMBON_CODE;
                item.LOCAL_ADDRESS1      = res.DataResponse.LOCAL_ADDRESS1;
                item.LOCAL_PROVINCE_CODE = res.DataResponse.PROVINCE_CODE;
                item.LOCAL_AREA_CODE     = res.DataResponse.LOCAL_AREA_CODE;
                item.LOCAL_TUMBON_CODE   = res.DataResponse.LOCAL_TUMBON_CODE;
                item.CREATED_DATE        = res.DataResponse.CREATED_DATE;

                item.ZIP_CODE      = res.DataResponse.ZIP_CODE;
                item.LOCAL_ZIPCODE = res.DataResponse.LOCAL_ZIPCODE;

                item.STATUS         = ddlStatus.SelectedValue;
                item.APPROVE_RESULT = txtResultReg.Text;
                item.APPROVED_BY    = userid;
                item.AGENT_TYPE     = res.DataResponse.AGENT_TYPE;
            }
            if (res.DataResponse == null)
            {
                this.UCModalError.ShowMessageError = res.ErrorMsg;
                this.UCModalError.ShowModalError();
                return;
            }

            if (ddlStatus.SelectedValue.Equals("5"))
            {
                item.STATUS         = DTO.PersonDataStatus.Approve.GetEnumValue().ToString();
                item.APPROVE_RESULT = txtResultReg.Text;
                var final = biz.EditPerson(item);

                //ถ้าเกิด Error อะไรให้มาทำในที่นี่ Tob 12022013
                if (final.IsError)
                {
                    //Response.Write(final.ErrorMsg);

                    UCModalError.ShowMessageError = final.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 (ddlStatus.SelectedValue.Equals("6") && res.DataResponse.STATUS == DTO.PersonDataStatus.WaitForApprove.GetEnumValue().ToString())
            {
                item.APPROVE_RESULT = txtResultReg.Text;
                var final = biz.EditPerson(item);

                //ถ้าเกิด Error อะไรให้มาทำในที่นี่ Tob 12022013
                if (final.IsError)
                {
                    //Response.Write(final.ErrorMsg);

                    UCModalError.ShowMessageError = final.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 (ddlStatus.SelectedValue.Equals("6"))
            //{
            //    List<String> persons = new List<string>() { item.ID };
            //    var final = biz.PersonNotApprove(persons);
            //    if (final.IsError)
            //    {

            //        UCModalError.ShowMessageError = final.ErrorMsg;
            //        UCModalError.ShowModalError();
            //    }
            //    else
            //    {
            //        string AlertSussuss = String.Format("alert('{0}');window.location.assign('../Register/regSearchOfficerOIC.aspx')", SysMessage.SaveSucess);
            //        ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", AlertSussuss, true);
            //    }

            //}
            else if (ddlStatus.SelectedValue.Equals(""))
            {
                UCModalError.ShowMessageError = Resources.errorEdit_Reg_Person_004;
                UCModalError.ShowModalError();
            }

            //var final = biz.EditPerson(item);

            ////ถ้าเกิด Error อะไรให้มาทำในที่นี่ Tob 12022013
            //if (final.IsError)
            //{
            //    //Response.Write(final.ErrorMsg);

            //    UCModalError.ShowMessageError = final.ErrorMsg;
            //    UCModalError.ShowModalError();

            //}

            //AlertMessage.ShowAlertMessage(string.Empty, SysMessage.SaveSucess);
        }
    protected void EntGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            int index = Convert.ToInt32(e.CommandArgument) % EntGridView.PageSize;

            string HDnID            = ((HiddenField)EntGridView.Rows[index].FindControl("UserID")).Value;
            string UserFullName     = ((Label)EntGridView.Rows[index].FindControl("UserFullName")).Text;
            string UserOrganization = ((Label)EntGridView.Rows[index].FindControl("UserOrganization")).Text;
            string UserTitle        = ((Label)EntGridView.Rows[index].FindControl("UserTitle")).Text;
            string Username         = ((Label)EntGridView.Rows[index].FindControl("Username")).Text;
            string UserMail         = ((Label)EntGridView.Rows[index].FindControl("UserMail")).Text;
            string UserPhone        = ((Label)EntGridView.Rows[index].FindControl("UserPhone")).Text;
            string UserAddress      = ((Label)EntGridView.Rows[index].FindControl("UserAddress")).Text;
            string UserActif        = ((Label)EntGridView.Rows[index].FindControl("UserActif")).Text;
            string ProfileName      = ((Label)EntGridView.Rows[index].FindControl("ProfileName")).Text;
            string UserNote         = ((Label)EntGridView.Rows[index].FindControl("UserNote")).Text;

            //This user is mixing with the User session ID
            HDnIDUserID = HDnID;

            if (e.CommandName.Equals("view"))
            {
                try
                {
                    txtUsername.ReadOnly = true;
                    txtUserMail.ReadOnly = true;

                    txtUserFullName.Text     = UserFullName;
                    txtUserOrganization.Text = UserOrganization;
                    txtUserTitle.Text        = UserTitle;
                    txtUsername.Text         = Username;
                    txtUserMail.Text         = UserMail;
                    txtUserPhone.Text        = UserPhone;
                    txtUserAddress.Text      = UserAddress;

                    DataTable dtActive = objUsers.GetActiveStatus(" where ActiveStatusName='" + UserActif + "'");
                    if (dtActive.Rows.Count > 0)
                    {
                        ddlUserActif.SelectedValue = dtActive.Rows[0]["ActiveStatusID"].ToString();
                    }

                    DataTable dtProfile = objProfile.GetProfile(" where ProfileName='" + ProfileName + "'");
                    if (dtActive.Rows.Count > 0)
                    {
                        ddlProfile.SelectedValue = dtProfile.Rows[0]["ProfileID"].ToString();
                    }

                    txtUserNote.Text = UserNote;

                    BtnSave.Text = "Update";
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("$('#addEdiModal').modal('show');");
                    sb.Append(@"</script>");
                    ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "addEdiModalScript", sb.ToString(), false);
                    upEdit.Update();
                }
                catch (Exception ex)
                {
                }
            }

            if (e.CommandName.Equals("deleting"))
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#deleteModal').modal('show');");
                sb.Append(@"</script>");
                ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DeleteModalScript", sb.ToString(), false);
                upDel.Update();
            }
        }
        catch (Exception ex)
        {
        }
    }