コード例 #1
0
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model = new IssueDocumentPosition(session);
                model.IssueDocumentPositionID = 0;
            }
            else if (!add && model == null)
            {
                model = GetIssueDocumentProvider().GetIssueDocumentPositionModel();
            }

            model.IssueDocumentID = issueDocumentRepo.GetIssueDocumentByID(GetIntValueFromSession(Enums.IssueDocumentSession.IssueDocumentID), model.Session);

            int supplierID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupSupplier));

            if (model.SupplierID != null)
            {
                model.SupplierID = clientRepo.GetClientByID(supplierID, model.SupplierID.Session);
            }
            else
            {
                model.SupplierID = clientRepo.GetClientByID(supplierID, model.Session);
            }

            //model.Quantity = CommonMethods.ParseDecimal(txtQuantity.Text);
            model.UID250 = !String.IsNullOrEmpty(txtUID250.Text) ? txtUID250.Text : model.UID250;
            //model.Name = txtName.Text;
            model.Notes = MemoNotes.Text;

            issueDocumentRepo.SaveIssueDocumentPosition(model, PrincipalHelper.GetUserID());

            return(true);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (userAction != (int)Enums.UserAction.Add)
                {
                    model = issueDocumentRepo.GetIssueDocumentByID(issueDocumentID);

                    if (model != null)
                    {
                        GetIssueDocumentProvider().SetIssueDocumentModel(model);
                        FillForm();
                    }
                }

                FillDefaultValues();
                UserActionConfirmBtnUpdate(btnSaveChanges, userAction);
            }
            else
            {
                if (model == null && SessionHasValue(Enums.IssueDocumentSession.IssueDocumentModel))
                {
                    model = GetIssueDocumentProvider().GetIssueDocumentModel();
                }
            }
        }