Beispiel #1
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            var parts = new Materials();

            parts.Add(new Material
            {
                PartNumber          = Code,
                Description         = Description,
                DetailedDescription = DetailedDescription,
                MaterialType        = new MaterialType {
                    Id = PartType
                },
                MaterialGroup = new MaterialGroup {
                    Id = PartGroup
                },
                Unit           = Unit,
                SalesPrice     = SalesPrice,
                Created        = CreatedDate,
                PriceValidDate = PriceValideDate
            });

            var firstOrDefault = parts.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.DataBaseInfo = UserContext.DataBaseInfo;
                firstOrDefault.Action       = Action;
            }
            if (_controlPanel.SetMaterials(parts))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.MaterialSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "MATERIALS SAVED",
                                  GlobalCustomResource.MaterialSaved, true);
                DivAction = false;
                clearForm();
                BindData(BindType.List);
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "openTabFunctionCall", "openTab(1)", true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.MaterialFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "MATERIALS UPDATE FAILED",
                                  GlobalCustomResource.MaterialFailed, true);
            }
        }