private void SaveRegionalApproverItem() { PSsqmEntities ctx = new PSsqmEntities(); INCFORM_APPROVER_LIST RegionalApproverAction = null; bool isNew = false; decimal personid = Convert.ToDecimal(ddlRegionalApprover.SelectedValue); decimal step = Convert.ToDecimal("5.50");//ddlStep.SelectedValue); //int priv = Convert.ToInt32(ddlPriv.SelectedValue); if (string.IsNullOrEmpty(hfRegionalApproverActionID.Value)) // add new item { //PERSON person = (from p in ctx.PERSON // where p.PERSON_ID == personid // select p).FirstOrDefault(); RegionalApproverAction = new INCFORM_APPROVER_LIST(); RegionalApproverAction.COMPANY_ID = Convert.ToDecimal(SessionManager.EffLocation.BusinessOrg.COMPANY_ID.ToString()); //person.COMPANY_ID;// RegionalApproverAction.BUS_ORG_ID = Convert.ToDecimal(SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID.ToString()); //person.BUS_ORG_ID;// RegionalApproverAction.PLANT_ID = Convert.ToDecimal(SessionManager.EffLocation.Plant.PLANT_ID.ToString()); RegionalApproverAction.CREATED_DATE = System.DateTime.Now; isNew = true; } else { RegionalApproverAction = SQMModelMgr.SelectINCFORMREGIONALAPPROVERSLIST(ctx, Convert.ToDecimal(hfRegionalApproverActionID.Value)); } RegionalApproverAction.PERSON_ID = personid; RegionalApproverAction.SSO_ID = (from P in ctx.PERSON where (P.PERSON_ID == personid) select P.SSO_ID).FirstOrDefault(); RegionalApproverAction.DESCRIPTION = txtDescription.Text; RegionalApproverAction.DESCRIPTION_QUESTION = "I approve this report for distribution"; // txtDescriptionQuestion.Text; RegionalApproverAction.STEP = step; RegionalApproverAction.PRIV = 391; // priv; RegionalApproverAction.TYPE = "R"; RegionalApproverAction.REQUIRED_COMPLETE = true; if ((RegionalApproverAction = SQMModelMgr.UpdateRegionalApproverAction(ctx, RegionalApproverAction)) != null) { if (isNew) { if (OnRegionalApproverActionCommand != null) { OnRegionalApproverActionCommand("add"); } ddlRegionalApprover.SelectedValue = "0"; //ddlStep.SelectedValue = "0"; //ddlPriv.SelectedValue = "0"; txtDescription.Text = ""; //txtDescriptionQuestion.Text = ""; rgRegionalApproverAction.DataSource = null; rgRegionalApproverAction.DataBind(); BindRegionalApproverList(SQMModelMgr.SelectINCFORMREGIONALAPPROVERLIST(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, SessionManager.EffLocation.Plant.PLANT_ID).ToList(), SessionManager.EffLocation, "busorg"); } else { ddlRegionalApprover.SelectedValue = "0"; //ddlStep.SelectedValue = "0"; //ddlPriv.SelectedValue = "0"; txtDescription.Text = ""; //txtDescriptionQuestion.Text = ""; rgRegionalApproverAction.DataSource = null; rgRegionalApproverAction.DataBind(); BindRegionalApproverList(SQMModelMgr.SelectINCFORMREGIONALAPPROVERLIST(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, SessionManager.EffLocation.Plant.PLANT_ID).ToList(), SessionManager.EffLocation, "busorg"); } } }