예제 #1
0
        protected override bool SaveData()
        {
            view.CloseEditor();
            bsDetail.EndEdit();

            AddHeader();

            DS_Request.SP_GetRequestDetailDataTable table = DataSetHelper.PackAlternationTypedDataTable <DS_Request.SP_GetRequestDetailDataTable>(ds_Request.SP_GetRequestDetail);
            DataSetHelper.RemoveColumns(table, true,
                                        table.RequestDetailIDColumn,
                                        table.MedicamentIDColumn,
                                        table.RequestQtyColumn,
                                        table.CountryCode1Column,
                                        table.CountryCode2Column,
                                        table.BrandIDColumn,
                                        table.OrdinalNumberColumn,
                                        table.ActionColumn);

            var ds = new DataSet("root");

            ds.Tables.Add(table);

            var id = RequestManager.AddOrEditRequest(RequestID, BranchID, RequestDate, Status, BaseGlobalVariable.UserID, BaseGlobalVariable.ServerDateTime, ApproverID, Guid.Empty, Action, DataSetHelper.InnerBytesData(ds));

            if (id > 0)
            {
                if (Action == DatabaseAction.Add)
                {
                    ds_Request.SP_GetRequestHeader[0].RequestID = id;
                    RequestID = id;
                }

                if (!OptionsEditForm.IsSaveAndCloseExecuting)
                {
                    BindingDetails();
                }
            }
            return(id > 0);
        }