protected void btn_submit_Click(object sender, EventArgs e) { if (hfdemployeeid.Value == "0") { //Utilities_Licensing.Insert_Employer(Convert.ToInt32(hfdpid.Value), 1, 2, txt_employeetype.Text.ToString(), txt_Name.Text.ToString(), txt_address.Text.ToString(), txt_city.Text.ToString(), ddlstate.SelectedItem.Text, txt_zip.Text.ToString(), ddlcounty.SelectedItem.Text, "1"); //Utilities_Licensing.BindGridEmployer(grdemployee); Person_Details.TBL_Licensing_Employer objemployer = new Person_Details.TBL_Licensing_Employer(); objemployer.Employer_Id = 0; objemployer.App_Id = "2"; objemployer.Person_ID = hfdpid.Value; objemployer.Employer_Type = txt_employeetype.Text.ToString(); objemployer.Employer_Name = txt_Name.Text.ToString(); objemployer.Address = txt_address.Text.ToString(); objemployer.City = txt_city.Text.ToString(); objemployer.State = ddlstate.SelectedValue.ToString(); objemployer.County = ddlcounty.SelectedValue.ToString(); objemployer.Zip = txt_zip.Text.ToString(); objemployer.isprocess = true; objemployer.createdby = Convert.ToString(Session["UID"]); objemployer.createddt = Convert.ToDateTime(DateTime.Now.ToShortDateString()); objemployer.modifiedby = Convert.ToString(Session["UID"]); objemployer.modifieddt = Convert.ToDateTime(DateTime.Now.ToShortDateString()); Person_Details.Licensing_Details.InsertEmployer(objemployer); //Utilities_Licensing.BindGridEmployer(grdemployee, Convert.ToInt32(hfdpid.Value)); Page.RegisterStartupScript("js", "<script>sa5.process();</script>"); altbox("Record inserted successfully."); Clear(); } else { Person_Details.TBL_Licensing_Employer objemployer = new Person_Details.TBL_Licensing_Employer(); objemployer.Employer_Id = Convert.ToInt32(hfdemployeeid.Value); objemployer.App_Id = "2"; objemployer.Person_ID = hfdpid.Value; objemployer.Employer_Type = txt_employeetype.Text.ToString(); objemployer.Employer_Name = txt_Name.Text.ToString(); objemployer.Address = txt_address.Text.ToString(); objemployer.City = txt_city.Text.ToString(); objemployer.State = ddlstate.SelectedValue.ToString(); objemployer.County = ddlcounty.SelectedValue.ToString(); objemployer.Zip = txt_zip.Text.ToString(); objemployer.isprocess = true; objemployer.createdby = Convert.ToString(Session["UID"]); objemployer.createddt = Convert.ToDateTime(DateTime.Now.ToShortDateString()); objemployer.modifiedby = Convert.ToString(Session["UID"]); objemployer.modifieddt = Convert.ToDateTime(DateTime.Now.ToShortDateString()); Person_Details.Licensing_Details.UpdateEmployer(objemployer); //Utilities_Licensing.BindGridEmployer(grdemployee, Convert.ToInt32(hfdpid.Value)); Page.RegisterStartupScript("js", "<script>sa5.process();</script>"); altbox("Record updated successfully."); Clear(); } }
protected void btnedit_click(object sender, EventArgs e) { string value = hfdselid.Value; Person_Details.TBL_Licensing_Employer obj = Utilities_Licensing.EditEmployer(Convert.ToInt32(value)); hfdemployeeid.Value = obj.Employer_Id.ToString(); txt_Name.Text = obj.Employer_Name; txt_employeetype.Text = obj.Employer_Type; txt_address.Text = obj.Address; string state = ""; state = obj.State.ToString(); if (ddlstate.Items[0].Text != state) { ddlstate.Items[0].Selected = false; if (ddlstate.Items.FindByValue(state) != null) { ddlstate.Items.FindByValue(state).Selected = true; } } string county = ""; county = obj.County.ToString(); if (ddlcounty.Items[0].Text != county) { ddlcounty.Items[0].Selected = false; if (ddlcounty.Items.FindByValue(county) != null) { ddlcounty.Items.FindByValue(county).Selected = true; } } //ddlstate.SelectedValue = obj.State; //ddlcounty.SelectedValue = obj.County; txt_city.Text = obj.City; txt_zip.Text = obj.Zip; string js = "Popup();"; ScriptManager.RegisterStartupScript(Page, GetType(), "scr", js, true); }