コード例 #1
0
    protected void OpenForm(int formID)
    {
        FormTableAdapter taForm = new FormTableAdapter();

        taForm.FillByID(this.InnerDS.Form, formID);
        FormDS.FormRow           rowForm        = this.InnerDS.Form[0];
        FormMaterialTableAdapter taFormMaterial = new FormMaterialTableAdapter();

        taFormMaterial.FillByID(this.InnerDS.FormMaterial, formID);
        FormDS.FormMaterialRow rowFormMaterial = this.InnerDS.FormMaterial[0];
        //赋值
        this.UCShop.ShopID        = rowFormMaterial.ShopID.ToString();
        this.FirstVolumeCtl.Text  = rowFormMaterial.FirstVolume.ToString();
        this.SecondVolumeCtl.Text = rowFormMaterial.SecondVolume.ToString();
        this.ThirdVolumeCtl.Text  = rowFormMaterial.ThirdVolume.ToString();
        this.RemarkCtl.Text       = rowFormMaterial.Remark;

        // 打开明细表
        FormMaterialDetailTableAdapter taDetail = new FormMaterialDetailTableAdapter();

        taDetail.FillByFormMaterialID(this.InnerDS.FormMaterialDetail, formID);
    }
コード例 #2
0
        public void UpdateFormMaterial(int FormID, SystemEnums.FormStatus StatusID, SystemEnums.FormType FormTypeID, int ShopID, int FirstVolume, int SecondVolume, int ThirdVolume, string Remark, string FlowTemplate)
        {
            SqlTransaction transaction = null;

            try {
                ////事务开始
                transaction = TableAdapterHelper.BeginTransaction(this.TAForm);
                TableAdapterHelper.SetTransaction(this.TAFormMaterial, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormMaterialDetail, transaction);

                FormDS.FormRow formRow = this.TAForm.GetDataByID(FormID)[0];
                UtilityBLL     utility = new UtilityBLL();
                if (StatusID == SystemEnums.FormStatus.Awaiting)
                {
                    string formTypeString = utility.GetFormTypeString((int)FormTypeID);
                    formRow.FormNo            = utility.GetFormNo(formTypeString);
                    formRow.InTurnUserIds     = "P"; //待改动
                    formRow.InTurnPositionIds = "P"; //待改动
                }
                else
                {
                    formRow.SetFormNoNull();
                }
                formRow.StatusID     = (int)StatusID;
                formRow.SubmitDate   = DateTime.Now;
                formRow.LastModified = DateTime.Now;
                this.TAForm.Update(formRow);

                //处理申请表的内容
                FormDS.FormMaterialRow formMaterialRow = this.TAFormMaterial.GetDataByID(FormID)[0];
                formMaterialRow.ShopID       = ShopID;
                formMaterialRow.FirstVolume  = FirstVolume;
                formMaterialRow.SecondVolume = SecondVolume;
                formMaterialRow.ThirdVolume  = ThirdVolume;
                formMaterialRow.Remark       = Remark;
                this.TAFormMaterial.Update(formMaterialRow);

                //明细表
                decimal totalAmount = 0;//计算总申请金额
                foreach (FormDS.FormMaterialDetailRow detailRow in this.FormDataSet.FormMaterialDetail)
                {
                    // 与父表绑定
                    if (detailRow.RowState != DataRowState.Deleted)
                    {
                        detailRow.FormMaterialID = formMaterialRow.FormMaterialID;
                        totalAmount += detailRow.Amount;
                    }
                }
                this.TAFormMaterialDetail.Update(this.FormDataSet.FormMaterialDetail);

                formMaterialRow.Amount = totalAmount;
                this.TAFormMaterial.Update(formMaterialRow);
                // 正式提交或草稿
                if (StatusID == SystemEnums.FormStatus.Awaiting)
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic["Apply_Amount"] = totalAmount;//金额
                    APHelper AP = new APHelper();
                    new APFlowBLL().ApplyForm(AP, TAForm, null, formRow, formRow.OrganizationUnitID, FlowTemplate, StatusID, dic);
                }
                transaction.Commit();
            } catch (Exception ex) {
                transaction.Rollback();
                throw new ApplicationException("Save Fail!" + ex.ToString());
            } finally {
                transaction.Dispose();
            }
        }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!this.IsPostBack)
        {
            PageUtility.SetContentTitle(this.Page, "广宣物资审批");
            this.Page.Title = "广宣物资审批";

            int formID = int.Parse(Request["ObjectId"]);
            this.ViewState["ObjectId"] = formID;
            FormDS.FormRow         rowForm         = this.MaterialApplyBLL.GetFormByID(formID)[0];
            FormDS.FormMaterialRow rowFormMaterial = this.MaterialApplyBLL.GetFormMaterialByID(formID)[0];
            if (rowForm.IsProcIDNull())
            {
                ViewState["ProcID"] = "";
            }
            else
            {
                ViewState["ProcID"] = rowForm.ProcID;
            }

            ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID;
            this.FormNoCtl.Text             = rowForm.FormNo;
            this.ApplyDateCtl.Text          = rowForm.SubmitDate.ToShortDateString();
            AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID);
            this.StuffNameCtl.Text    = applicant.StuffName;
            this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName;
            if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null)
            {
                this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName;
            }
            this.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString();

            ERS.ShopRow shop = new MasterDataBLL().GetShopByID(rowFormMaterial.ShopID);
            this.CustomerNameCtl.Text  = new MasterDataBLL().GetCustomerById(shop.CustomerID).CustomerName;
            this.ShopNameCtl.Text      = shop.ShopName;
            this.FirstVolumeCtl.Text   = rowFormMaterial.FirstVolume.ToString("N");
            this.SecondVolumeCtl.Text  = rowFormMaterial.SecondVolume.ToString("N");
            this.ThirdVolumeCtl.Text   = rowFormMaterial.ThirdVolume.ToString("N");
            this.AverageVolumeCtl.Text = rowFormMaterial.AverageVolume.ToString("N");
            this.RemarkCtl.Text        = rowFormMaterial.Remark;

            this.odsMaterialDetails.SelectParameters["FormMaterialID"].DefaultValue = rowFormMaterial.FormMaterialID.ToString();

            //审批页面处理&按钮处理
            AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
            this.ViewState["StuffUserID"] = stuffUser.StuffUserId;
            if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P"))
            {
                this.SubmitBtn.Visible   = true;
                this.cwfAppCheck.IsView  = false;
                this.ViewState["IsView"] = false;
            }
            else
            {
                this.SubmitBtn.Visible   = false;
                this.cwfAppCheck.IsView  = true;
                this.ViewState["IsView"] = true;
            }

            if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && ((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffUserId == rowForm.UserID)
            {
                this.EditBtn.Visible  = true;
                this.ScrapBtn.Visible = true;
            }
            else
            {
                this.EditBtn.Visible  = false;
                this.ScrapBtn.Visible = false;
            }

            //如果是弹出,取消按钮不可见
            if (this.Request["ShowDialog"] != null)
            {
                if (this.Request["ShowDialog"].ToString() == "1")
                {
                    this.upButton.Visible = false;
                    this.Master.FindControl("divMenu").Visible       = false;
                    this.Master.FindControl("tbCurrentPage").Visible = false;
                }
            }
        }
        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
コード例 #4
0
        public void AddFormMaterial(int?RejectedFormID, int UserID, int?ProxyUserID, int?ProxyPositionID, int OrganizationUnitID, int PositionID, SystemEnums.FormType FormTypeID,
                                    SystemEnums.FormStatus StatusID, int ShopID, int FirstVolume, int SecondVolume, int ThirdVolume, string Remark, string FlowTemplate)
        {
            SqlTransaction transaction = null;

            try {
                transaction = TableAdapterHelper.BeginTransaction(this.TAForm);
                TableAdapterHelper.SetTransaction(this.TAFormMaterial, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormMaterialDetail, transaction);

                FormDS.FormRow formRow = this.FormDataSet.Form.NewFormRow();
                if (RejectedFormID != null)
                {
                    formRow.RejectedFormID = RejectedFormID.GetValueOrDefault();
                }
                formRow.UserID = UserID;
                UtilityBLL utility = new UtilityBLL();
                if (StatusID == SystemEnums.FormStatus.Awaiting)
                {
                    string formTypeString = utility.GetFormTypeString((int)FormTypeID);
                    formRow.FormNo = utility.GetFormNo(formTypeString);
                }
                else
                {
                    formRow.SetFormNoNull();
                }
                if (ProxyUserID != null)
                {
                    formRow.ProxyUserID = ProxyUserID.GetValueOrDefault();
                }
                if (ProxyPositionID != null)
                {
                    formRow.ProxyPositionID = ProxyPositionID.GetValueOrDefault();
                }
                formRow.OrganizationUnitID = OrganizationUnitID;
                formRow.PositionID         = PositionID;
                formRow.FormTypeID         = (int)FormTypeID;
                formRow.StatusID           = (int)StatusID;
                formRow.SubmitDate         = DateTime.Now;
                formRow.LastModified       = DateTime.Now;
                formRow.InTurnUserIds      = "P"; //待改动
                formRow.InTurnPositionIds  = "P"; //待改动
                formRow.PageType           = (int)SystemEnums.PageType.MaterialApply;
                this.FormDataSet.Form.AddFormRow(formRow);
                this.TAForm.Update(formRow);

                //处理申请表的内容
                FormDS.FormMaterialRow formMaterialRow = this.FormDataSet.FormMaterial.NewFormMaterialRow();
                formMaterialRow.FormMaterialID = formRow.FormID;
                formMaterialRow.ShopID         = ShopID;
                formMaterialRow.FirstVolume    = FirstVolume;
                formMaterialRow.SecondVolume   = SecondVolume;
                formMaterialRow.ThirdVolume    = ThirdVolume;
                formMaterialRow.Amount         = 0;//默认值
                formMaterialRow.Remark         = Remark;

                this.FormDataSet.FormMaterial.AddFormMaterialRow(formMaterialRow);
                this.TAFormMaterial.Update(formMaterialRow);

                //明细表
                decimal totalAmount = 0;//计算总申请金额

                if (RejectedFormID != null)
                {
                    FormDS.FormMaterialDetailDataTable newDetailTable = new FormDS.FormMaterialDetailDataTable();
                    foreach (FormDS.FormMaterialDetailRow detailRow in this.FormDataSet.FormMaterialDetail)
                    {
                        if (detailRow.RowState != System.Data.DataRowState.Deleted)
                        {
                            FormDS.FormMaterialDetailRow newDetailRow = newDetailTable.NewFormMaterialDetailRow();
                            newDetailRow.FormMaterialID = formMaterialRow.FormMaterialID;
                            newDetailRow.MaterialID     = detailRow.MaterialID;
                            ERS.MaterialRow material = new MasterDataBLL().GetMaterialById(detailRow.MaterialID);
                            newDetailRow.MaterialName  = material.MaterialName;
                            newDetailRow.UOM           = material.UOM;
                            newDetailRow.Description   = material.Description;
                            newDetailRow.MaterialPrice = material.MaterialPrice;
                            newDetailRow.Quantity      = detailRow.Quantity;
                            newDetailRow.Amount        = newDetailRow.MaterialPrice * detailRow.Quantity;
                            if (!detailRow.IsRemarkNull())
                            {
                                newDetailRow.Remark = detailRow.Remark;
                            }
                            totalAmount += newDetailRow.Amount;
                            newDetailTable.AddFormMaterialDetailRow(newDetailRow);
                        }
                    }
                    this.TAFormMaterialDetail.Update(newDetailTable);
                }
                else
                {
                    foreach (FormDS.FormMaterialDetailRow detailRow in this.FormDataSet.FormMaterialDetail)
                    {
                        // 与父表绑定
                        if (detailRow.RowState != DataRowState.Deleted)
                        {
                            detailRow.FormMaterialID = formMaterialRow.FormMaterialID;
                            totalAmount += detailRow.Amount;
                        }
                    }
                    this.TAFormMaterialDetail.Update(this.FormDataSet.FormMaterialDetail);
                }

                formMaterialRow.Amount = totalAmount;
                this.TAFormMaterial.Update(formMaterialRow);

                // 正式提交或草稿

                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic["Apply_Amount"] = totalAmount;    //金额
                APHelper AP = new APHelper();
                new APFlowBLL().ApplyForm(AP, TAForm, RejectedFormID, formRow, OrganizationUnitID, FlowTemplate, StatusID, dic);

                transaction.Commit();
            } catch (Exception ex) {
                transaction.Rollback();
                throw new ApplicationException("Save Fail!" + ex.ToString());
            } finally {
                transaction.Dispose();
            }
        }