protected void ddlRegionalApproverList_Click(object sender, EventArgs e) { DropDownList ddlRegionalApproverList = (DropDownList)sender; GridDataItem row = (GridDataItem)ddlRegionalApproverList.NamingContainer; HiddenField hfApproverItemID = (HiddenField)row.FindControl("hfApproverItemID"); HiddenField hfApproverPerson_Id = (HiddenField)row.FindControl("hfApproverPerson_Id"); string perid = ddlRegionalApproverList.SelectedValue; if (ddlRegionalApproverList.SelectedValue == "0") { ddlRegionalApproverList.Attributes.Add("class", "CSSHI"); string script = "function ferrorMsg(){alert('You cannot select invalid option from approver list.'); Sys.Application.remove_load(ferrorMsg);}Sys.Application.add_load(ferrorMsg);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); ddlRegionalApproverList.SelectedValue = hfApproverPerson_Id.Value; } else { ddlRegionalApproverList.Attributes.Add("class", "CSSRHI"); PSsqmEntities ctx = new PSsqmEntities(); INCFORM_APPROVER_LIST ApproverAction = null; ApproverAction = SQMModelMgr.SelectINCFORMAPPROVERSLIST(ctx, Convert.ToDecimal(hfApproverItemID.Value)); decimal personid = Convert.ToDecimal(ddlRegionalApproverList.SelectedValue); ApproverAction.PERSON_ID = personid; ApproverAction.SSO_ID = (from P in ctx.PERSON where (P.PERSON_ID == personid) select P.SSO_ID).FirstOrDefault(); if ((ApproverAction = SQMModelMgr.UpdateApproverAction(ctx, ApproverAction, true)) != null) { //ddlApprover.SelectedValue = "0"; //ddlStep.SelectedValue = "0"; //ddlPriv.SelectedValue = "0"; txtDescription.Text = ""; //txtDescriptionQuestion.Text = ""; rgApproverAction.DataSource = null; rgApproverAction.DataBind(); rgRegionalApproverAction.DataSource = null; rgRegionalApproverAction.DataBind(); BindApproverListR(SQMModelMgr.SelectINCFORMAPPROVERLIST(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, SessionManager.EffLocation.Plant.PLANT_ID, "R").ToList(), SessionManager.EffLocation, "busorg"); BindApproverListA(SQMModelMgr.SelectINCFORMAPPROVERLIST(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, SessionManager.EffLocation.Plant.PLANT_ID, "A").ToList(), SessionManager.EffLocation, "busorg"); } } }
private void SaveApproverItem() { PSsqmEntities ctx = new PSsqmEntities(); INCFORM_APPROVER_LIST ApproverAction = null; bool isNew = false; //decimal personid = Convert.ToDecimal(ddlApprover.SelectedValue); decimal step = Convert.ToDecimal("5.50");// Convert.ToDecimal(ddlStep.SelectedValue); decimal stepf = Convert.ToDecimal("2.50"); //int priv = Convert.ToInt32(ddlPriv.SelectedValue); if (string.IsNullOrEmpty(hfApproverActionID.Value)) // add new item { ApproverAction = new INCFORM_APPROVER_LIST(); ApproverAction.COMPANY_ID = Convert.ToDecimal(SessionManager.EffLocation.BusinessOrg.COMPANY_ID.ToString()); //person.COMPANY_ID;// ApproverAction.BUS_ORG_ID = Convert.ToDecimal(SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID.ToString()); //person.BUS_ORG_ID;// ApproverAction.PLANT_ID = Convert.ToDecimal(SessionManager.EffLocation.Plant.PLANT_ID.ToString()); ApproverAction.CREATED_DATE = System.DateTime.Now; isNew = true; } else { ApproverAction = SQMModelMgr.SelectINCFORMAPPROVERSLIST(ctx, Convert.ToDecimal(hfApproverActionID.Value)); } //ApproverAction.PERSON_ID = personid; //ApproverAction.SSO_ID = (from P in ctx.PERSON // where (P.PERSON_ID == personid) // select P.SSO_ID).FirstOrDefault(); ApproverAction.DESCRIPTION = txtDescription.Text; ApproverAction.DESCRIPTION_QUESTION = "I approve this report for distribution";// txtDescriptionQuestion.Text; ApproverAction.STEP = step; ApproverAction.STEPFLASH = stepf; ApproverAction.PRIV = 391; // priv; ApproverAction.TYPE = ddlApproverType.SelectedValue; // = ApproverAction.TYPE; ApproverAction.REQUIRED_COMPLETE = true; if ((ApproverAction = SQMModelMgr.UpdateApproverAction(ctx, ApproverAction, false)) != null) { if (isNew) { if (OnApproverActionCommand != null) { OnApproverActionCommand("add"); } // ddlApprover.SelectedValue = "0"; //ddlStep.SelectedValue = "0"; //ddlPriv.SelectedValue = "0"; ddlApproverType.SelectedValue = "0"; txtDescription.Text = ""; // txtDescriptionQuestion.Text = ""; rgApproverAction.DataSource = null; rgApproverAction.DataBind(); rgRegionalApproverAction.DataSource = null; rgRegionalApproverAction.DataBind(); BindApproverListA(SQMModelMgr.SelectINCFORMAPPROVERLIST(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, SessionManager.EffLocation.Plant.PLANT_ID, "A").ToList(), SessionManager.EffLocation, "busorg"); BindApproverListR(SQMModelMgr.SelectINCFORMAPPROVERLIST(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, SessionManager.EffLocation.Plant.PLANT_ID, "R").ToList(), SessionManager.EffLocation, "busorg"); } else { //ddlApprover.SelectedValue = "0"; //ddlStep.SelectedValue = "0"; //ddlPriv.SelectedValue = "0"; ddlApproverType.SelectedValue = "0"; txtDescription.Text = ""; //txtDescriptionQuestion.Text = ""; rgApproverAction.DataSource = null; rgApproverAction.DataBind(); rgRegionalApproverAction.DataSource = null; rgRegionalApproverAction.DataBind(); BindApproverListA(SQMModelMgr.SelectINCFORMAPPROVERLIST(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, SessionManager.EffLocation.Plant.PLANT_ID, "A").ToList(), SessionManager.EffLocation, "busorg"); BindApproverListR(SQMModelMgr.SelectINCFORMAPPROVERLIST(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, SessionManager.EffLocation.Plant.PLANT_ID, "R").ToList(), SessionManager.EffLocation, "busorg"); } } }
protected void ddlApproverList_Click(object sender, EventArgs e) { DropDownList ddlApproverList = (DropDownList)sender; GridDataItem row = (GridDataItem)ddlApproverList.NamingContainer; HiddenField hfApproverItemID = (HiddenField)row.FindControl("hfApproverItemID"); HiddenField hfApproverPerson_Id = (HiddenField)row.FindControl("hfApproverPerson_Id"); string perid = ddlApproverList.SelectedValue; if (ddlApproverList.SelectedValue == "0") { ddlApproverList.Attributes.Add("class", "CSSHI"); string script = "function ferrorMsg(){alert('You cannot select invalid option from approver list.'); Sys.Application.remove_load(ferrorMsg);}Sys.Application.add_load(ferrorMsg);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); ddlApproverList.SelectedValue = hfApproverPerson_Id.Value; } else { ddlApproverList.Attributes.Add("class", "CSSRHI"); PSsqmEntities ctx = new PSsqmEntities(); INCFORM_APPROVER_LIST ApproverAction = null; ApproverAction = SQMModelMgr.SelectINCFORMAPPROVERSLIST(ctx, Convert.ToDecimal(hfApproverItemID.Value)); decimal personid = Convert.ToDecimal(ddlApproverList.SelectedValue); ApproverAction.PERSON_ID = personid; ApproverAction.SSO_ID = (from P in ctx.PERSON where (P.PERSON_ID == personid) select P.SSO_ID).FirstOrDefault(); if ((ApproverAction = SQMModelMgr.UpdateApproverAction(ctx, ApproverAction, true)) != null) { //ddlApprover.SelectedValue = "0"; //ddlStep.SelectedValue = "0"; //ddlPriv.SelectedValue = "0"; txtDescription.Text = ""; //txtDescriptionQuestion.Text = ""; rgApproverAction.DataSource = null; rgApproverAction.DataBind(); rgRegionalApproverAction.DataSource = null; rgRegionalApproverAction.DataBind(); BindApproverListA(SQMModelMgr.SelectINCFORMAPPROVERLIST(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, SessionManager.EffLocation.Plant.PLANT_ID, "A").ToList(), SessionManager.EffLocation, "busorg"); BindApproverListR(SQMModelMgr.SelectINCFORMAPPROVERLIST(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, SessionManager.EffLocation.Plant.PLANT_ID, "R").ToList(), SessionManager.EffLocation, "busorg"); //INCFORM_APPROVER_LIST appList = (from i in ctx.INCFORM_APPROVER_LIST where i.PLANT_ID == ApproverAction.PLANT_ID && i.TYPE == "N" select i).FirstOrDefault(); //EHSNotificationMgr.NotifyAddApprover(appList.PERSON_ID, ApproverAction.PERSON_ID, "Add/Update Approver"); } } //string _text1 = txtECustCode.Text.ToString(); //try //{ // INCFORMAPPROVERLIST ApproverAction = SQMModelMgr.LookupINCFORMAPPROVERLIST(new PSsqmEntities(), Convert.ToDecimal(lnk.)); // if (ApproverAction != null) // { // hfApproverActionID.Value = ApproverAction.INCFORM_APPROVER_LIST_ID.ToString(); // //ddlApprover.SelectedValue = ApproverAction.PERSON_ID.ToString(); // ddlApproverType.SelectedValue = ApproverAction.TYPE; // txtDescription.Text = ApproverAction.DESCRIPTION; // //ddlPriv.SelectedValue = ApproverAction.PRIV.ToString(); // //ddlStep.SelectedValue = ApproverAction.STEP.ToString(); // //txtDescriptionQuestion.Text = ApproverAction.DESCRIPTION_QUESTION; // btnDelete.Visible = true; // } // string script = "function f(){OpenApproverEditWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; // ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); //} //catch //{ //} }