Beispiel #1
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            BUSINESS_ORG bu     = (BUSINESS_ORG)SessionManager.BusinessOrg;
            BUSINESS_ORG busOrg = null;

            if (!Page.IsValid)
            {
                return;
            }

            if (bu == null)
            {
                busOrg = new BUSINESS_ORG();
            }
            else
            {
                busOrg = SQMModelMgr.LookupBusOrg(entities, SessionManager.SessionContext.ActiveCompany().COMPANY_ID, bu.BUS_ORG_ID);
            }

            bool    success;
            decimal decVal;

            busOrg.ORG_NAME  = GetFindControlValue("tbOrgname", hfBase, out success);
            busOrg.DUNS_CODE = GetFindControlValue("tbOrgLocCode", hfBase, out success);
            if (decimal.TryParse(GetFindControlValue("tbThreshold", hfBase, out success), out decVal))
            {
                busOrg.THRESHOLD_AMT = decVal;
            }
            busOrg.PREFERRED_CURRENCY_CODE = GetFindControlValue("ddlCurrencyCodes", hfBase, out success);
            busOrg.STATUS = GetFindControlValue("ddlStatus", hfBase, out success);
            string sel = GetFindControlValue("ddlParentBusOrg", hfBase, out success);

            if (string.IsNullOrEmpty(sel))
            {
                busOrg.PARENT_BUS_ORG_ID = Convert.ToInt32(null);
            }
            else
            {
                busOrg.PARENT_BUS_ORG_ID = Int32.Parse(sel);
            }

            busOrg = (BUSINESS_ORG)SQMModelMgr.SetObjectTimestamp((object)busOrg, SessionManager.UserContext.UserName(), busOrg.EntityState);

            if (bu == null)
            {
                busOrg.COMPANY_ID = SessionManager.SessionContext.ActiveCompany().COMPANY_ID;
                SQMModelMgr.CreateBusOrg(entities, busOrg);
                SessionManager.BusOrgSearchCriteria = busOrg.ORG_NAME;
            }
            else
            {
                entities.SaveChanges();
            }

            SessionManager.BusinessOrg = busOrg;

            SetupPage();
        }
Beispiel #2
0
        protected void SaveBusOrg()
        {
            BUSINESS_ORG bu     = (BUSINESS_ORG)SessionManager.EffLocation.BusinessOrg;
            BUSINESS_ORG busOrg = null;

            if (!Page.IsValid)
            {
                return;
            }

            if (bu == null)
            {
                busOrg = SQMModelMgr.CreateBusOrg(entities, SessionManager.EffLocation.Company.COMPANY_ID, "");
            }
            else
            {
                busOrg = SQMModelMgr.LookupBusOrg(entities, SessionManager.EffLocation.Company.COMPANY_ID, bu.BUS_ORG_ID);
            }

            bool    success;
            decimal decVal;

            busOrg.ORG_NAME  = GetFindControlValue("tbOrgname", hfBase, out success);
            busOrg.DUNS_CODE = GetFindControlValue("tbOrgLocCode", hfBase, out success);
            busOrg.PREFERRED_CURRENCY_CODE = GetFindControlValue("ddlCurrencyCodes", hfBase, out success);
            busOrg.STATUS = GetFindControlValue("ddlStatus", hfBase, out success);
            string sel = GetFindControlValue("ddlParentBusOrg", hfBase, out success);

            if (string.IsNullOrEmpty(sel))
            {
                busOrg.PARENT_BUS_ORG_ID = Convert.ToInt32(null);
            }
            else
            {
                busOrg.PARENT_BUS_ORG_ID = Int32.Parse(sel);
            }

            busOrg = (BUSINESS_ORG)SQMModelMgr.SetObjectTimestamp((object)busOrg, SessionManager.UserContext.UserName(), busOrg.EntityState);


            entities.SaveChanges();

            SessionManager.EffLocation.BusinessOrg = busOrg;

            // SetupPage();
        }