Ejemplo n.º 1
0
 protected void btnSave_ServerClick(object sender, EventArgs e)
 {
     using (StandardEntityDAO dao = new StandardEntityDAO("Leave"))
     {
         dao.BeginTrans();
         if (!this.UCBiddingSupplierList1.SelectedSupplierFlag && this.BiddingPrejudicationModify1.State1 == ModuleState.Operable)
         {
             this.RegisterStartupScript("", "<script>alert('请选择预审通过单位!');</script>");
             return;
         }
         try
         {
             bool bl = DataSubmit(dao);
             dao.CommitTrans();
             if (bl)
             {
                 Response.Write(Rms.Web.JavaScript.ScriptStart);
                 Response.Write(Rms.Web.JavaScript.OpenerReload(false));
                 Response.Write(Rms.Web.JavaScript.WinClose(false));
                 Response.Write(Rms.Web.JavaScript.ScriptEnd);
             }
         }
         catch (Exception ex)
         {
             dao.RollBackTrans();
             if (ex.Message == "编号不能为空")
             {
                 Response.Write(Rms.Web.JavaScript.Alert(true, ex.Message));
                 return;
             }
             throw ex;
         }
     }
 }
Ejemplo n.º 2
0
 public static void SaveWorkCaseEx(DataSet workCaseDs, string caseCode, string ActCode)
 {
     try
     {
         EntityData        entitydata = WorkFlowRule.SaveWorkFlowCaseData(workCaseDs, caseCode);
         StandardEntityDAO ydao       = new StandardEntityDAO("Standard_WorkFlowCase");
         ydao.BeginTrans();
         try
         {
             if (entitydata != null)
             {
                 for (int i = entitydata.Tables["WorkFlowAct"].Rows.Count - 1; i >= 0; i--)
                 {
                     if (ActCode == entitydata.Tables["WorkFlowAct"].Rows[i]["ActCode"].ToString())
                     {
                         entitydata.Tables["WorkFlowAct"].Rows[i].Delete();
                     }
                 }
                 ydao.SubmitEntity(entitydata);
             }
             ydao.CommitTrans();
         }
         catch (Exception exception)
         {
             ydao.RollBackTrans();
             throw exception;
         }
         entitydata.Dispose();
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 3
0
        /// ****************************************************************************
        /// <summary>
        /// 删除按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ****************************************************************************
        protected void btnDel_ServerClick(object sender, System.EventArgs e)
        {
            /****************************************************************************/
            using (StandardEntityDAO dao = new StandardEntityDAO("Leave"))
            {
                dao.BeginTrans();
                try
                {
                    this.BiddingEmitModify1.dao = dao;
                    this.BiddingEmitModify1.Delete();
                    this.BiddingReturnModify1.dao = dao;
                    this.BiddingReturnModify1.Delete();

                    /*******************************************************/
                    dao.CommitTrans();
                }
                catch (Exception ex)
                {
                    dao.RollBackTrans();
                    throw ex;
                }
            }
            /*******************************************************************/

            Response.Write(Rms.Web.JavaScript.ScriptStart);
            Response.Write(Rms.Web.JavaScript.OpenerReload(false));
            Response.Write(Rms.Web.JavaScript.WinClose(false));
            Response.Write(Rms.Web.JavaScript.ScriptEnd);
        }
Ejemplo n.º 4
0
 protected void btnSave_ServerClick(object sender, EventArgs e)
 {
     using (StandardEntityDAO dao = new StandardEntityDAO("Leave"))
     {
         dao.BeginTrans();
         try
         {
             if (!this.BiddingAuditing1.SupplierSelectedFlag && this.BiddingAuditing1.State == ModuleState.Operable)
             {
                 this.RegisterStartupScript("", "<script>alert('请选择中标单位!');</script>");
                 return;
             }
             bool bl = DataSubmit(dao);
             dao.CommitTrans();
             if (bl)
             {
                 Response.Write(Rms.Web.JavaScript.ScriptStart);
                 Response.Write(Rms.Web.JavaScript.OpenerReload(false));
                 Response.Write(Rms.Web.JavaScript.WinClose(false));
                 Response.Write(Rms.Web.JavaScript.ScriptEnd);
             }
         }
         catch (Exception ex)
         {
             dao.RollBackTrans();
             throw ex;
         }
     }
 }
Ejemplo n.º 5
0
        public static void SubmitAllStandard_ConstructProgress(EntityData entity)
        {
            Exception exception;

            try
            {
                using (StandardEntityDAO ydao = new StandardEntityDAO("Standard_ConstructProgress"))
                {
                    ydao.BeginTrans();
                    try
                    {
                        ydao.SubmitEntity(entity);
                        ydao.CommitTrans();
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        ydao.RollBackTrans();
                        throw exception;
                    }
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                throw exception;
            }
        }
Ejemplo n.º 6
0
        private void ImportSalSingle(string s, string ProjectCode, string jd)
        {
            string[] m_strSub = s.Replace("\"", "").Split(',');

            if (m_strSub.Length < 9)            // && (m_strSub[0] != "供应商代码"))
            {
                return;
            }

            //小计、合计(即客户姓名为空)不导
            if (m_strSub[1].Trim() == "")
            {
                return;
            }

            //过滤基地
            if (jd != "")
            {
                if (m_strSub[4] != jd)
                {
                    return;
                }
            }

            string ContractCode = m_strSub[2];

            using (StandardEntityDAO dao = new StandardEntityDAO("SalContract"))
            {
                dao.BeginTrans();
                try
                {
                    ImportSalContract(m_strSub, ContractCode, ProjectCode, dao);
                    ImportSalPay(m_strSub, ContractCode, ProjectCode, dao);
//					ImportSalPayPlan(m_strSub, ContractCode, ProjectCode, dao);
//					ImportSalPayRela(m_strSub, ContractCode, ProjectCode, dao);

//					EntityData entitySalContract = ImportSalContract(ContractCode, ProjectCode, dsSrc, dao);
//					EntityData entitySalPay = ImportSalPay(ContractCode, ProjectCode, dsSrc, dao);

                    dao.CommitTrans();
                }
                catch (Exception ex)
                {
                    try
                    {
                        //RollBackTrans会报错:此 SqlTransaction 已完成;它再也无法使用
                        dao.RollBackTrans();
                    }
                    catch
                    {
                    }

                    throw ex;
                }
            }
        }
Ejemplo n.º 7
0
        public static void DtsPaySingleByClient(string ClientCode)
        {
            Exception exception;

            try
            {
                SalService srv   = new SalService();
                DataSet    dsSrc = srv.GetSalDataByClient(ClientCode);
                DataTable  table = dsSrc.Tables["Client"];
                if (table.Rows.Count > 0)
                {
                    string projectCode = ProjectRule.GetProjectCodeBySalProjectCode(table.Rows[0]["proj_code"].ToString());
                    switch (projectCode)
                    {
                    case null:
                    case "":
                        throw new Exception("该客户在项目管理系统中无对应的项目");
                    }
                    using (StandardEntityDAO dao = new StandardEntityDAO("SalClient"))
                    {
                        dao.BeginTrans();
                        try
                        {
                            EntityData data  = ImportSalClientByClient(ClientCode, projectCode, dsSrc, dao);
                            EntityData data2 = ImportSalContractByClient(ClientCode, projectCode, dsSrc, dao);
                            EntityData data3 = ImportSalPayByClient(ClientCode, projectCode, dsSrc, dao);
                            EntityData data4 = ImportSalPayPlanByClient(ClientCode, projectCode, dsSrc, dao);
                            EntityData data5 = ImportSalPayRelaByClient(ClientCode, projectCode, dsSrc, dao);
                            dao.CommitTrans();
                        }
                        catch (Exception exception1)
                        {
                            exception = exception1;
                            try
                            {
                                dao.RollBackTrans();
                            }
                            catch
                            {
                            }
                            throw exception;
                        }
                        SetSalImpFlag(srv, dsSrc);
                    }
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                throw exception;
            }
        }
Ejemplo n.º 8
0
        protected void btnSave_ServerClick(object sender, System.EventArgs e)
        {
            if (BiddingReturnModify1.BiddingReturnCheck())
            {
                this.RegisterStartupScript("CheckAlert", "<script>alert('回标单位金额和日期必须同时填写!');</script>");
                return;
            }
            else
            {
                using (StandardEntityDAO dao = new StandardEntityDAO("BiddingReturn"))
                {
                    dao.BeginTrans();
                    try
                    {
                        /***********************************************************/
                        this.BiddingReturnModify1.dao = dao;
                        this.BiddingReturnModify1.SubmitData();

                        /*******************************************************/
                        dao.CommitTrans();
                        //手工回标,直接置为已开标
                        BiddingBFL.SetEmit_State(Request["BiddingEmitCode"] + "", 1);
                        Response.Write("<script>window.opener.location.reload(true)</script>");
                        // Response.Write("<script>window.close()</script>");

                        /*Response.Write(Rms.Web.JavaScript.ScriptStart);
                         * Response.Write(Rms.Web.JavaScript.OpenerReload(false));
                         * Response.Write(Rms.Web.JavaScript.WinClose(false));
                         * Response.Write(Rms.Web.JavaScript.ScriptEnd);*/
                    }
                    catch (Exception ex)
                    {
                        dao.RollBackTrans();
                        Response.Write(Rms.Web.JavaScript.Alert(true, "请填写回标单位日期!"));
                        //throw ex;
                    }
                    finally
                    {
                    }
                }
            }
            /*******************************************************************/
        }
Ejemplo n.º 9
0
 public static void SaveContractAuditing(DataSet workCaseDs, EntityData applicationEntity, EntityData contractEntity, string caseCode)
 {
     try
     {
         EntityData        entitydata = WorkFlowRule.SaveWorkFlowCaseData(workCaseDs, caseCode);
         StandardEntityDAO ydao       = new StandardEntityDAO("Standard_WorkFlowCase");
         ydao.BeginTrans();
         try
         {
             try
             {
                 if (entitydata != null)
                 {
                     ydao.SubmitEntity(entitydata);
                 }
                 ydao.EntityName = "WorkFlow_Leave";
                 ydao.SubmitEntity(applicationEntity);
                 ydao.EntityName = "Standard_Contract";
                 ydao.SubmitEntity(contractEntity);
                 ydao.CommitTrans();
             }
             catch (Exception exception)
             {
                 ydao.RollBackTrans();
                 throw exception;
             }
         }
         finally
         {
             ydao.Dispose();
         }
         entitydata.Dispose();
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 10
0
 protected void btnSave_ServerClick(object sender, EventArgs e)
 {
     using (StandardEntityDAO dao = new StandardEntityDAO("Leave"))
     {
         dao.BeginTrans();
         try
         {
             bool bl = DataSubmit(dao);
             dao.CommitTrans();
             if (bl)
             {
                 Response.Write(Rms.Web.JavaScript.ScriptStart);
                 Response.Write(Rms.Web.JavaScript.OpenerReload(false));
                 Response.Write(Rms.Web.JavaScript.WinClose(false));
                 Response.Write(Rms.Web.JavaScript.ScriptEnd);
             }
         }
         catch (Exception ex)
         {
             dao.RollBackTrans();
             //Response.Write(Rms.Web.JavaScript.Alert(true, ex.Message));
         }
     }
 }
Ejemplo n.º 11
0
        /// ****************************************************************************
        /// <summary>
        /// 工具栏事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ****************************************************************************
        protected void WorkFlowToolbar1_ToolbarCommand(object sender, System.EventArgs e)
        {
            /****************************************************************************/
            using (StandardEntityDAO dao = new StandardEntityDAO("Standard_WorkFlowProcedure"))
            {
                dao.BeginTrans();
                try
                {
                    /***********************************************************/
                    //签收
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.SignIn)
                    {
                        WorkFlowToolbar1.SignIn(dao);
                        InitPage();
                    }
                    //发送
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Send)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.Send();
                    }
                    //保存
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Save)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.Save();
                        WorkFlowPropertySave();

                        Response.Write(Rms.Web.JavaScript.ScriptStart);
                        Response.Write(Rms.Web.JavaScript.OpenerReload(false));
                        //Response.Write(Rms.Web.JavaScript.WinClose(false));
                        Response.Write(Rms.Web.JavaScript.ScriptEnd);
                    }
                    //完成
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.TaskFinish)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.TaskFinish();
                    }
                    //结束
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Finish)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.Finish();
                        ContractControlBase.ContractAuditing(WorkFlowToolbar1.ApplicationCode);
                    }
                    //抄送
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.MakeCopy)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.MakeCopy();
                    }
                    /*******************************************************/
                    dao.CommitTrans();
                }
                catch (Exception ex)
                {
                    dao.RollBackTrans();
                    throw ex;
                }
            }
            /*******************************************************************/
        }
Ejemplo n.º 12
0
 /// ****************************************************************************
 /// <summary>
 /// 工具栏事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// ****************************************************************************
 virtual protected void WorkFlowToolbar_ToolbarCommand(object sender, System.EventArgs e)
 {
     using (StandardEntityDAO dao = new StandardEntityDAO(this.EntityName))
     {
         dao.BeginTrans();
         try
         {
             //签收
             if (wftToolbar.CommandType == ToolbarCommandType.SignIn)
             {
                 ToolBarSignIn(dao);
             }
             //发送
             if (wftToolbar.CommandType == ToolbarCommandType.Send)
             {
                 ToolBarSend(dao);
             }
             //退回
             if (wftToolbar.CommandType == ToolbarCommandType.Back)
             {
                 ToolBarBack(dao);
             }
             //送经办人
             if (wftToolbar.CommandType == ToolbarCommandType.BackTop)
             {
                 ToolBarBackTop(dao);
             }
             //收回
             if (wftToolbar.CommandType == ToolbarCommandType.Return)
             {
                 ToolBarReturn(dao);
             }
             //保存意见
             if (wftToolbar.CommandType == ToolbarCommandType.Opinion)
             {
                 ToolBarSaveOpinion(dao);
             }
             //保存
             if (wftToolbar.CommandType == ToolbarCommandType.Save)
             {
                 ToolBarSave(dao);
             }
             //完成
             if (wftToolbar.CommandType == ToolbarCommandType.TaskFinish)
             {
                 ToolBarTaskFinish(dao);
             }
             //结束
             if (wftToolbar.CommandType == ToolbarCommandType.Finish)
             {
                 ToolBarFinish(dao);
             }
             //抄送
             if (wftToolbar.CommandType == ToolbarCommandType.MakeCopy)
             {
                 ToolBarMakeCopy(dao);
             }
             //删除
             if (wftToolbar.CommandType == ToolbarCommandType.Delete)
             {
                 ToolBarDelete(dao);
             }
             dao.CommitTrans();
         }
         catch (Exception ex)
         {
             dao.RollBackTrans();
             Response.Write(Rms.Web.JavaScript.Alert(true, ex.Message));
             throw ex;
         }
     }
 }
Ejemplo n.º 13
0
        /// ****************************************************************************
        /// <summary>
        /// 工具栏事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ****************************************************************************
        override protected void WorkFlowToolbar1_ToolbarCommand(object sender, System.EventArgs e)
        {
            /****************************************************************************/
            using (StandardEntityDAO dao = new StandardEntityDAO("Leave"))
            {
                dao.BeginTrans();
                try
                {
                    /***********************************************************/
                    //签收
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.SignIn)
                    {
                        WorkFlowToolbar1.SignIn(dao);
                        if (this.WorkFlowToolbar1.GetModuleState("Opinion4") == ModuleState.Operable)
                        {
                            WorkFlowToolbar1.SaveCasePropertyValue("用户类别", user.GetOperationType());
                        }
                        if (WorkFlowToolbar1.GetModuleState("BaseWrite") == ModuleState.Operable)
                        {
                            BiddingSystem.Set_BiddingState("3", this.BiddingAuditing1.BiddingCode);
                        }
                        InitPage();
                    }
                    //发送
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Send)
                    {
                        if (!this.BiddingAuditing1.SupplierSelectedFlag && this.BiddingAuditing1.State == ModuleState.Operable)
                        {
                            this.RegisterStartupScript("", "<script>alert('请选择中标单位!');</script>");
                            return;
                        }
                        DataSubmit(dao);
                        ///
                        //Bll.Bidding bidding = new Bidding();
                        //bidding..BiddingCode
                        //更新bidding 为评标状态
                        if (WorkFlowToolbar1.GetModuleState("BaseWrite") == ModuleState.Operable)
                        {
                            BiddingSystem.Set_BiddingState("5", this.BiddingAuditing1.BiddingCode);
                        }
                        WorkFlowToolbar1.Send();
                    }
                    //退回
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Back)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.Back();
                        //if(WorkFlowToolbar1.GetModuleState("BaseWrite")==ModuleState.Operable)
                        //{
                        //	BiddingSystem.Set_BiddingState("3");
                        //}
                    }
                    //收回
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Return)
                    {
                        WorkFlowToolbar1.Return();
                    }


                    //送经办人
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.BackTop)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.BackTop();
                    }
                    //保存意见
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Opinion)
                    {
                        WorkFlowToolbar1.SaveOpinion();
                        this.WorkFlowCaseState1.ControlDataBind();
                    }

                    //保存
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Save)
                    {
                        if (!this.BiddingAuditing1.SupplierSelectedFlag && this.BiddingAuditing1.State == ModuleState.Operable)
                        {
                            this.RegisterStartupScript("", "<script>alert('请选择中标单位!');</script>");
                            return;
                        }
                        DataSubmit(dao);
                        WorkFlowToolbar1.Save();
                        WorkFlowPropertySave();
                        if (!this.WorkFlowToolbar1.IsNew)
                        {
                            Response.Write(Rms.Web.JavaScript.ScriptStart);
                            Response.Write(Rms.Web.JavaScript.OpenerReload(false));
                            Response.Write(Rms.Web.JavaScript.WinClose(false));
                            Response.Write(Rms.Web.JavaScript.ScriptEnd);
                        }
                        //更新bidding 为评标状态
                        if (WorkFlowToolbar1.GetModuleState("BaseWrite") == ModuleState.Operable)
                        {
                            BiddingSystem.Set_BiddingState("3", this.BiddingAuditing1.BiddingCode);
                        }
                    }
                    //完成
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.TaskFinish)
                    {
                        if (!this.BiddingAuditing1.SupplierSelectedFlag && this.BiddingAuditing1.State == ModuleState.Operable)
                        {
                            this.RegisterStartupScript("", "<script>alert('请选择中标单位!');</script>");
                            return;
                        }
                        DataSubmit(dao);
                        WorkFlowToolbar1.TaskFinish();
                    }
                    //结束
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Finish)
                    {
                        if (!this.BiddingAuditing1.SupplierSelectedFlag && this.BiddingAuditing1.State == ModuleState.Operable)
                        {
                            this.RegisterStartupScript("", "<script>alert('请选择中标单位!');</script>");
                            return;
                        }
                        this.BiddingAuditing1.State = this.WorkFlowToolbar1.GetModuleState("SupplierSelect");
                        DataSubmit(dao);
                        WorkFlowToolbar1.Finish();
                    }
                    //抄送
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.MakeCopy)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.MakeCopy();
                    }
                    /*******************************************************/
                    dao.CommitTrans();
                }
                catch (Exception ex)
                {
                    dao.RollBackTrans();
                    throw ex;
                }
            }
            /*******************************************************************/
        }
Ejemplo n.º 14
0
        //this.WorkFlowToolbar1.ToolbarCommand += new System.EventHandler(this.WorkFlowToolbar1_ToolbarCommand);

        private void WorkFlowToolbar1_ToolbarCommand(object sender, System.EventArgs e)
        {
            /****************************************************************************/
            using (StandardEntityDAO dao = new StandardEntityDAO("Standard_WorkFlowProcedure"))
            {
                dao.BeginTrans();
                try
                {
                    /***********************************************************/
                    //签收
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.SignIn)
                    {
                        WorkFlowToolbar1.SignIn(dao);
                        InitPage();
                    }
                    //发送
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Send)
                    {
                        if (!CheckData())
                        {
                            return;
                        }
                        EntityData entity = this.SaveData();
                        RmsPM.DAL.EntityDAO.OADAO.SubmitAllOAEquipmentApply(entity);
                        WorkFlowToolbar1.ApplicationCode    = OAEquipmentApplyCode;
                        this.EnquipmentUse1.ApplicationCode = OAEquipmentApplyCode;
                        EntityData entity1 = this.EnquipmentUse1.SaveData((string)ViewState["Unit"], (string)ViewState["User"]);
                        RmsPM.DAL.EntityDAO.OADAO.SubmitAllOAEquipmentUse(entity1);
                        entity.Dispose();
                        entity1.Dispose();

                        WorkFlowToolbar1.Send();
                    }
                    //保存
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Save)
                    {
                        if (!CheckData())
                        {
                            return;
                        }
                        EntityData entity = this.SaveData();
                        RmsPM.DAL.EntityDAO.OADAO.SubmitAllOAEquipmentApply(entity);
                        WorkFlowToolbar1.ApplicationCode = OAEquipmentApplyCode;
                        EntityData entity1 = this.EnquipmentUse1.SaveData((string)ViewState["Unit"], (string)ViewState["User"]);
                        RmsPM.DAL.EntityDAO.OADAO.SubmitAllOAEquipmentUse(entity1);
                        entity.Dispose();
                        entity1.Dispose();

                        WorkFlowToolbar1.Save();
                    }
                    //完成
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.TaskFinish)
                    {
                        WorkFlowToolbar1.TaskFinish();
                    }
                    //结束
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Finish)
                    {
                        WorkFlowToolbar1.ApplicationCode = OAEquipmentApplyCode;
                        EntityData entity1 = this.EnquipmentUse1.SaveData((string)ViewState["Unit"], (string)ViewState["User"]);
                        RmsPM.DAL.EntityDAO.OADAO.SubmitAllOAEquipmentUse(entity1);
                        entity1.Dispose();

                        WorkFlowToolbar1.Finish();
                    }
                    //抄送
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.MakeCopy)
                    {
                        WorkFlowToolbar1.MakeCopy();
                    }
                    /*******************************************************/
                    dao.CommitTrans();
                }
                catch (Exception ex)
                {
                    dao.RollBackTrans();
                    throw ex;
                }
            }
            /*******************************************************************/
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 保存
        /// </summary>
        private void SavaData()
        {
            try
            {
                string CostBudgetSetCode = this.txtCostBudgetSetCode.Value;
                string CostBudgetCode;

                //取当前预算设置表的所有费用项
                EntityData entityAllCBS = BLL.CostBudgetRule.GetAllCBSBySet(this.txtProjectCode.Value, this.txtCostBudgetSetCode.Value);

                //保存动态费用表
                EntityData entity = BLL.CostBudgetRule.GetValidCostBudget(CostBudgetSetCode, 0);
                bool       isNew  = false;

                DataRow dr = null;
                if (!entity.HasRecord())
                {
                    isNew          = true;
                    CostBudgetCode = RmsPM.DAL.EntityDAO.SystemManageDAO.GetNewSysCode("CostBudgetCode");

                    dr = entity.CurrentTable.NewRow();
                    dr["CostBudgetCode"]    = CostBudgetCode;
                    dr["CostBudgetSetCode"] = CostBudgetSetCode;
                    dr["ProjectCode"]       = this.txtProjectCode.Value;

                    dr["Status"]              = 1;
                    dr["TargetFlag"]          = 0;
                    dr["FirstCostBudgetCode"] = CostBudgetCode;
                    dr["VerID"] = 0;

                    entity.CurrentTable.Rows.Add(dr);
                }
                else
                {
                    CostBudgetCode = entity.GetString("CostBudgetCode");

                    dr = entity.CurrentRow;
                }

                //动态费用明细历史记录
                EntityData entityDtlHis = DAL.EntityDAO.CostBudgetDAO.GetCostBudgetDtlHisByCode("");

                //动态费用明细(所有)
                EntityData entityDtl = DAL.EntityDAO.CostBudgetDAO.GetV_CostBudgetDtlByCostBudgetCode(CostBudgetCode);

                //当前一条动态费用明细
                DataRow[] drs = entityDtl.CurrentTable.Select("CostCode = '" + this.txtCostCode.Value + "'");
                DataRow   drDtl;
                if (drs.Length <= 0)
                {
                    drDtl = entityDtl.CurrentTable.NewRow();

                    drDtl["CostBudgetDtlCode"] = RmsPM.DAL.EntityDAO.SystemManageDAO.GetNewSysCode("CostBudgetDtlCode");
                    drDtl["CostBudgetCode"]    = CostBudgetCode;
                    drDtl["ProjectCode"]       = this.txtProjectCode.Value;
                    drDtl["CostCode"]          = this.txtCostCode.Value;

                    //填费用项信息
                    BLL.CostBudgetPageRule.FillCostBudgetDtlCBSData(drDtl, entityAllCBS.CurrentTable);

                    entityDtl.CurrentTable.Rows.Add(drDtl);
                }
                else
                {
                    drDtl = drs[0];

                    //保存动态费用明细历史记录
                    BLL.CostBudgetRule.AddCostBudgetDtlHis(entityDtlHis.CurrentTable, drDtl, dr);
                }

                //预留金额直接录入,不要包括已定的非合同请款 xyq 2018.7.24
                drDtl["BudgetMoney"] = BLL.ConvertRule.ToDecimal(this.txtMoney.Value);

                /*
                 *              //动态费用 = 预算金额 + 已定合同
                 *              decimal money = BLL.ConvertRule.ToDecimal(this.txtMoney.Value) + BLL.ConvertRule.ToDecimal(this.txtContractMoney.Value);
                 *              drDtl["BudgetMoney"] = money;
                 */

                drDtl["Description"] = this.txtDescription.Value;

                //更新父项的动态费用
                string   FullCode    = drDtl["FullCode"].ToString();
                string[] arrCostCode = FullCode.Split("-".ToCharArray());
                for (int i = arrCostCode.Length - 2; i >= 0; i--)
                {
                    //费用项必须属于当前预算设置表
                    if (entityAllCBS.CurrentTable.Select("CostCode = '" + arrCostCode[i] + "'").Length <= 0)
                    {
                        break;
                    }

                    DataRow[] drsP = entityDtl.CurrentTable.Select("CostCode = '" + arrCostCode[i] + "'");
                    DataRow   drP;
                    if (drsP.Length > 0)
                    {
                        drP = drsP[0];
                    }
                    else
                    {
                        drP = entityDtl.CurrentTable.NewRow();

                        drP["CostBudgetDtlCode"] = RmsPM.DAL.EntityDAO.SystemManageDAO.GetNewSysCode("CostBudgetDtlCode");
                        drP["CostBudgetCode"]    = CostBudgetCode;
                        drP["ProjectCode"]       = this.txtProjectCode.Value;
                        drP["CostCode"]          = arrCostCode[i];

                        //填费用项信息
                        BLL.CostBudgetPageRule.FillCostBudgetDtlCBSData(drP, entityAllCBS.CurrentTable);

                        entityDtl.CurrentTable.Rows.Add(drP);
                    }

                    //父项的动态费用 = 子项累计
                    DataRow[] drsChild       = entityDtl.CurrentTable.Select("ParentCode = '" + drP["CostCode"].ToString() + "'");
                    decimal   SumBudgetMoney = BLL.MathRule.SumColumn(drsChild, "BudgetMoney");

                    //保存动态费用明细历史记录
                    BLL.CostBudgetRule.AddCostBudgetDtlHis(entityDtlHis.CurrentTable, drP, dr);

                    drP["BudgetMoney"] = SumBudgetMoney;
                }

                //保存主表
                if (isNew)
                {
                    dr["ModifyPerson"] = base.user.UserCode;
                    dr["ModifyDate"]   = DateTime.Now;

//					dr["CreatePerson"] = base.user.UserCode;
//					dr["CreateDate"] = DateTime.Now;
                }
                else
                {
                    dr["ModifyPerson"] = base.user.UserCode;
                    dr["ModifyDate"]   = DateTime.Now;
                }

                //保存主表的预算总额
                BLL.CostBudgetRule.SaveCostBudgetTotalBudgetMoney(entity.CurrentTable, entityDtl.CurrentTable);

                //提交
                using (StandardEntityDAO dao = new StandardEntityDAO("CostBudget"))
                {
                    dao.BeginTrans();
                    try
                    {
                        //提交主表
                        dao.SubmitEntity(entity);

                        //提交明细
                        dao.EntityName = "CostBudgetDtl";
                        dao.SubmitEntity(entityDtl);

                        //提交明细历史
                        dao.EntityName = "CostBudgetDtlHis";
                        dao.SubmitEntity(entityDtlHis);


                        dao.CommitTrans();
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            //RollBackTrans会报错:此 SqlTransaction 已完成;它再也无法使用
                            dao.RollBackTrans();
                        }
                        catch
                        {
                        }

                        throw ex;
                    }
                }

                /*
                 * DAL.EntityDAO.CostBudgetDAO.SubmitAllCostBudget(entity);
                 * DAL.EntityDAO.CostBudgetDAO.SubmitAllCostBudgetDtl(entityDtl);
                 */

                entity.Dispose();
                entityDtl.Dispose();
                entityDtlHis.Dispose();
                entityAllCBS.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 16
0
        /// ****************************************************************************
        /// <summary>
        /// 工具栏事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ****************************************************************************
        override protected void WorkFlowToolbar1_ToolbarCommand(object sender, System.EventArgs e)
        {
            /****************************************************************************/
            using (StandardEntityDAO dao = new StandardEntityDAO("Leave"))
            {
                dao.BeginTrans();
                try
                {
                    /***********************************************************/
                    //签收
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.SignIn)
                    {
                        WorkFlowToolbar1.SignIn(dao);
                        if (this.WorkFlowToolbar1.GetModuleState("Opinion4") == ModuleState.Operable)
                        {
                            WorkFlowToolbar1.SaveCasePropertyValue("用户类别", user.GetOperationType());
                        }

                        InitPage();

                        this.DataGridShowState();
                        UCBiddingSupplierList1.LoadEditData();
                    }
                    //发送
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Send)
                    {
                        //this.RegisterStartupScript("","<script>alert('请选择预审通过单位!');</script>");
                        if (!this.UCBiddingSupplierList1.SelectedSupplierFlag && this.BiddingPrejudicationModify1.State1 == ModuleState.Operable)
                        {
                            this.RegisterStartupScript("", "<script>alert('请选择预审通过单位!');</script>");
                            return;
                        }
                        try
                        {
                            DataSubmit(dao);
                            //UCBiddingSupplierList1.UpdateDepartMentSelect();
                        }
                        catch (Exception ex)
                        {
                            Response.Write(Rms.Web.JavaScript.Alert(true, ex.Message));
                        }
                        WorkFlowToolbar1.Send();
                    }
                    //退回
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Back)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.Back();
                    }
                    //收回
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Return)
                    {
                        WorkFlowToolbar1.Return();
                    }
                    //送经办人
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.BackTop)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.BackTop();
                    }
                    //保存意见
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Opinion)
                    {
                        WorkFlowToolbar1.SaveOpinion();
                        this.WorkFlowCaseState1.ControlDataBind();
                        //UCBiddingSupplierList1.UpdateDepartMentSelect();
                    }
                    //保存
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Save)
                    {
                        ///if(!this.UCBiddingSupplierList1.SelectedSupplierFlag && this.BiddingPrejudicationModify1.State1 == ModuleState.Operable)
                        //{
                        //	this.RegisterStartupScript("","<script>alert('请选择预审通过单位!');</script>");
                        //	return;
                        //}
                        try
                        {
                            DataSubmit(dao);
                            //UCBiddingSupplierList1.UpdateDepartMentSelect();
                        }
                        catch (Exception ex)
                        {
                            Response.Write(Rms.Web.JavaScript.Alert(true, ex.Message));
                        }
                        WorkFlowToolbar1.Save();
                        WorkFlowPropertySave();
                        if (!this.WorkFlowToolbar1.IsNew)
                        {
                            Response.Write(Rms.Web.JavaScript.ScriptStart);
                            Response.Write(Rms.Web.JavaScript.OpenerReload(false));
                            Response.Write(Rms.Web.JavaScript.WinClose(false));
                            Response.Write(Rms.Web.JavaScript.ScriptEnd);
                        }
                    }
                    //完成
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.TaskFinish)
                    {
                        if (!this.UCBiddingSupplierList1.SelectedSupplierFlag && this.BiddingPrejudicationModify1.State1 == ModuleState.Operable)
                        {
                            this.RegisterStartupScript("", "<script>alert('请选择预审通过单位!');</script>");
                            return;
                        }
                        DataSubmit(dao);
                        WorkFlowToolbar1.TaskFinish();
                    }
                    //结束
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Finish)
                    {
                        if (!this.UCBiddingSupplierList1.SelectedSupplierFlag && this.BiddingPrejudicationModify1.State1 == ModuleState.Operable)
                        {
                            this.RegisterStartupScript("", "<script>alert('请选择预审通过单位!');</script>");
                            return;
                        }
                        DataSubmit(dao);
                        WorkFlowToolbar1.Finish();
                    }
                    //抄送
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.MakeCopy)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.MakeCopy();
                    }
                    //删除
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Delete)
                    {
                        WorkFlowToolbar1.Delete();
                        UCBiddingSupplierList1.DeleteAll(dao);
                    }
                    /*******************************************************/
                    dao.CommitTrans();
                }
                catch (Exception ex)
                {
                    dao.RollBackTrans();
                    throw ex;
                }
            }
            /*******************************************************************/
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 保存
        /// </summary>
        private void SaveData(DataTable tbDtl, ref bool IsNeedCheck)
        {
            try
            {
                string CostBudgetCode = this.txtCostBudgetCode.Value;
                IsNeedCheck = true;
                string ChangingCostBudgetCode = "";

                //取申请或调整中的目标费用表
                EntityData entity = DAL.EntityDAO.CostBudgetDAO.GetCostBudgetByStatus(this.txtCostBudgetSetCode.Value, 1, "0,3", false);
                if (entity.HasRecord())
                {
                    ChangingCostBudgetCode = entity.GetString("CostBudgetCode");
                }
                entity.Dispose();

                //取当前有效的目标费用
                EntityData entityValid = BLL.CostBudgetRule.GetValidCostBudget(this.txtCostBudgetSetCode.Value, 1);

                if (this.txtStatus.Value == "3")                  //调整
                {
                    IsNeedCheck = BLL.CostBudgetRule.IsCostTargetNeedCheck(this.txtCostBudgetSetCode.Value, tbDtl);
                }

                if (!IsNeedCheck)                  //无需审核时,直接更新当前有效的目标费用
                {
                    this.txtCostBudgetCode.Value = "";
                    CostBudgetCode = entityValid.GetString("CostBudgetCode");
                }

                //要保存的目标费用
                entity = RmsPM.DAL.EntityDAO.CostBudgetDAO.GetStandard_CostBudgetByCode(CostBudgetCode);

                //保存预算主表
                BLL.CostBudgetRule.SaveTempTarget(entity, entityValid, this.txtProjectCode.Value, this.txtCostBudgetSetCode.Value, BLL.ConvertRule.ToInt(this.txtStatus.Value), base.user.UserCode, this.txtCostBudgetName.Value);
                this.txtCostBudgetCode.Value = entity.GetString("CostBudgetCode");

                //保存预算明细
                BLL.CostBudgetRule.SaveCostBudgetDtl(entity, tbDtl, BLL.ConvertRule.ToString(ViewState["StartY"]), BLL.ConvertRule.ToString(ViewState["EndY"]));

                //保存主表的预算总额
                BLL.CostBudgetRule.SaveCostBudgetTotalBudgetMoney(entity.Tables["CostBudget"], entity.Tables["CostBudgetDtl"]);

                //提交
                using (StandardEntityDAO dao = new StandardEntityDAO("CostBudget"))
                {
                    dao.BeginTrans();
                    try
                    {
                        dao.SubmitEntity(entity);

                        //删除调整中的目标费用
                        if (!IsNeedCheck)
                        {
                            BLL.CostBudgetRule.DeleteChangingTarget(ChangingCostBudgetCode, dao);
                        }

                        dao.CommitTrans();
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            //RollBackTrans会报错:此 SqlTransaction 已完成;它再也无法使用
                            dao.RollBackTrans();
                        }
                        catch
                        {
                        }

                        throw ex;
                    }
                }

//				DAL.EntityDAO.CostBudgetDAO.SubmitAllStandard_CostBudget(entity);

                entity.Dispose();
                entityValid.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 保存
        /// </summary>
        private void SavaData()
        {
            try
            {
                string CostBudgetSetCode      = this.txtCostBudgetSetCode.Value;
                string CostBudgetCode         = "";
                int    status                 = 0;
                bool   IsNeedCheck            = true;
                string ChangingCostBudgetCode = "";

                //屏幕数据保存到临时表
                EntityData entityScreen = DAL.EntityDAO.CostBudgetDAO.GetCostBudgetDtlByCode("");
                DataTable  tbScreen     = entityScreen.CurrentTable;

                DataRow drScreen = tbScreen.NewRow();
                drScreen["CostBudgetDtlCode"] = -1;
                drScreen["CostCode"]          = this.txtCostCode.Value;
                drScreen["BudgetMoney"]       = BLL.ConvertRule.ToDecimal(this.txtMoney.Value);
                drScreen["Description"]       = this.txtDescription.Value;
                tbScreen.Rows.Add(drScreen);

                DataTable tbDtl = BLL.CostBudgetRule.BuildTempTargetDtl(this.txtProjectCode.Value, this.txtCostBudgetSetCode.Value, tbScreen, ref status);
                entityScreen.Dispose();
//				DataTable tbDtl = BLL.CostBudgetRule.BuildTempTargetDtl(this.txtProjectCode.Value, this.txtCostBudgetSetCode.Value, this.txtCostCode.Value, BLL.ConvertRule.ToDecimal(this.txtMoney.Value), this.txtDescription.Value, ref status);

                //取申请或调整中的目标费用表
                EntityData entity = DAL.EntityDAO.CostBudgetDAO.GetCostBudgetByStatus(CostBudgetSetCode, 1, "0,3", false);
                if (entity.HasRecord())
                {
                    CostBudgetCode         = entity.GetString("CostBudgetCode");
                    ChangingCostBudgetCode = entity.GetString("CostBudgetCode");
                }
                entity.Dispose();

                //取当前有效的目标费用
                EntityData entityValid = BLL.CostBudgetRule.GetValidCostBudget(this.txtCostBudgetSetCode.Value, 1);

                if (status == 3)                  //调整
                {
                    IsNeedCheck = BLL.CostBudgetRule.IsCostTargetNeedCheck(this.txtCostBudgetSetCode.Value, tbDtl);
                }

                if (!IsNeedCheck)                  //无需审核时,直接更新当前有效的目标费用
                {
                    CostBudgetCode = entityValid.GetString("CostBudgetCode");
                }

                //要保存的目标费用
                entity = RmsPM.DAL.EntityDAO.CostBudgetDAO.GetStandard_CostBudgetByCode(CostBudgetCode);

                //保存预算主表
                BLL.CostBudgetRule.SaveTempTarget(entity, entityValid, this.txtProjectCode.Value, this.txtCostBudgetSetCode.Value, status, base.user.UserCode, "");

                //保存预算明细
                BLL.CostBudgetRule.SaveCostBudgetDtl(entity, tbDtl, "", "");

                //保存主表的预算总额
                BLL.CostBudgetRule.SaveCostBudgetTotalBudgetMoney(entity.Tables["CostBudget"], entity.Tables["CostBudgetDtl"]);

                //提交
                using (StandardEntityDAO dao = new StandardEntityDAO("CostBudget"))
                {
                    dao.BeginTrans();
                    try
                    {
                        dao.SubmitEntity(entity);

                        //删除调整中的目标费用
                        if (!IsNeedCheck)
                        {
                            BLL.CostBudgetRule.DeleteChangingTarget(ChangingCostBudgetCode, dao);
                        }

                        dao.CommitTrans();
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            //RollBackTrans会报错:此 SqlTransaction 已完成;它再也无法使用
                            dao.RollBackTrans();
                        }
                        catch
                        {
                        }

                        throw ex;
                    }
                }

                entity.Dispose();
                entityValid.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 19
0
        /// ****************************************************************************
        /// <summary>
        /// 工具栏事件

        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ****************************************************************************
        protected void WorkFlowToolbar1_ToolbarCommand(object sender, System.EventArgs e)
        {
            /****************************************************************************/
            using (StandardEntityDAO dao = new StandardEntityDAO("DesignDocument"))
            {
                dao.BeginTrans();
                try
                {
                    /***********************************************************/
                    //签收
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.SignIn)
                    {
                        WorkFlowToolbar1.SignIn(dao);
                        InitPage();
                    }
                    //发送

                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Send)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.Send();
                    }
                    //保存
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Save)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.Save();
                        WorkFlowPropertySave();
                        if (!this.WorkFlowToolbar1.IsNew)
                        {
                            Response.Write(Rms.Web.JavaScript.ScriptStart);
                            Response.Write(Rms.Web.JavaScript.OpenerReload(false));
                            Response.Write(Rms.Web.JavaScript.WinClose(false));
                            Response.Write(Rms.Web.JavaScript.ScriptEnd);
                        }
                    }
                    //完成
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.TaskFinish)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.TaskFinish();
                    }
                    //结束
                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Finish)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.Finish();
                    }
                    //抄送

                    if (WorkFlowToolbar1.CommandType == ToolbarCommandType.MakeCopy)
                    {
                        DataSubmit(dao);
                        WorkFlowToolbar1.MakeCopy();
                    }
                    /*******************************************************/

                    //退回

                    if (this.WorkFlowToolbar1.CommandType == ToolbarCommandType.Back)
                    {
                        DataSubmit(dao);
                        this.WorkFlowToolbar1.Back();
                    }
                    //送经办人
                    if (this.WorkFlowToolbar1.CommandType == ToolbarCommandType.BackTop)
                    {
                        DataSubmit(dao);
                        this.WorkFlowToolbar1.BackTop();
                    }
                    //收回
                    if (this.WorkFlowToolbar1.CommandType == ToolbarCommandType.Return)
                    {
                        DataSubmit(dao);
                        this.WorkFlowToolbar1.Return();
                    }
                    //保存意见
                    if (this.WorkFlowToolbar1.CommandType == ToolbarCommandType.Opinion)
                    {
                        DataSubmit(dao);
                        this.WorkFlowToolbar1.SaveOpinion();
                        this.WorkFlowCaseState1.ControlDataBind();
                    }
                    dao.CommitTrans();
                }
                catch (Exception ex)
                {
                    dao.RollBackTrans();
                    throw ex;
                }
            }
            /*******************************************************************/
        }
Ejemplo n.º 20
0
        public static void DeleteSystemGroup(string GroupCode)
        {
            Exception exception;

            try
            {
                if (GroupCode != "")
                {
                    string message = CheckDeleteSystemGroup(GroupCode);
                    if (message != "")
                    {
                        throw new Exception(message);
                    }
                    EntityData systemGroupByCode = SystemManageDAO.GetSystemGroupByCode(GroupCode);
                    if (systemGroupByCode.HasRecord())
                    {
                        string    keyvalues;
                        string    parentFullID = systemGroupByCode.GetString("FullID");
                        DataTable table        = new DataTable();
                        table.Columns.Add("AccessRangeCode");
                        EntityData systemGroupIncludeAllChildByParentFullID = SystemManageDAO.GetSystemGroupIncludeAllChildByParentFullID(parentFullID);
                        foreach (DataRow row in systemGroupIncludeAllChildByParentFullID.CurrentTable.Rows)
                        {
                            EntityData accessRangeByGroupCode = ResourceDAO.GetAccessRangeByGroupCode(row["GroupCode"].ToString());
                            foreach (DataRow row2 in accessRangeByGroupCode.CurrentTable.Rows)
                            {
                                keyvalues = row2["AccessRangeCode"].ToString();
                                DataRow row3 = table.NewRow();
                                row3["AccessRangeCode"] = keyvalues;
                                table.Rows.Add(row3);
                            }
                            accessRangeByGroupCode.Dispose();
                        }
                        using (StandardEntityDAO ydao = new StandardEntityDAO("SystemGroup"))
                        {
                            ydao.BeginTrans();
                            try
                            {
                                foreach (DataRow row3 in table.Rows)
                                {
                                    keyvalues       = row3["AccessRangeCode"].ToString();
                                    ydao.EntityName = "AccessRange";
                                    EntityData entitydata = new EntityData("AccessRange");
                                    entitydata = ydao.SelectbyPrimaryKey(keyvalues);
                                    ydao.DeleteAllRow(entitydata);
                                    ydao.DeleteEntity(entitydata);
                                    entitydata.Dispose();
                                }
                                foreach (DataRow row3 in systemGroupIncludeAllChildByParentFullID.CurrentTable.Rows)
                                {
                                    string text3 = row3["GroupCode"].ToString();
                                    ydao.EntityName = "SystemGroup";
                                    EntityData data5 = new EntityData("SystemGroup");
                                    data5 = ydao.SelectbyPrimaryKey(text3);
                                    ydao.DeleteAllRow(data5);
                                    ydao.DeleteEntity(data5);
                                    data5.Dispose();
                                }
                                ydao.CommitTrans();
                            }
                            catch (Exception exception1)
                            {
                                exception = exception1;
                                try
                                {
                                    ydao.RollBackTrans();
                                }
                                catch
                                {
                                }
                                throw exception;
                            }
                        }
                        systemGroupIncludeAllChildByParentFullID.Dispose();
                    }
                    systemGroupByCode.Dispose();
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                throw exception;
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 清空
        /// </summary>
        private static void DeleteSingle(string ProjectCode, string VoucherID)
        {
            try
            {
                string VoucherCode = "";

                //取系统的凭证号
                QueryAgent qa = new QueryAgent();
                try
                {
                    VoucherCode = BLL.ConvertRule.ToString(qa.ExecuteScalar(String.Format("select VoucherCode from Voucher where VoucherID = '{0}' and ProjectCode='{1}'", VoucherID, ProjectCode)));
                }
                finally
                {
                    qa.Dispose();
                }

                //删除老的凭证、请款、付款
                //事务处理
                using (StandardEntityDAO dao = new StandardEntityDAO("Voucher"))
                {
                    dao.BeginTrans();
                    try
                    {
                        if (VoucherCode != "")
                        {
                            //删除凭证
                            dao.EntityName = "Standard_Voucher";
                            EntityData entityV = DAL.EntityDAO.PaymentDAO.GetStandard_VoucherByCode(VoucherCode);
                            if (entityV.HasRecord())
                            {
                                dao.DeleteAllRow(entityV);
                                dao.DeleteEntity(entityV);
                            }
                            entityV.Dispose();
                        }

                        //取系统的请款单号
                        string PaymentCode = "";
                        qa = new Rms.ORMap.QueryAgent();
                        try
                        {
                            PaymentCode = BLL.ConvertRule.ToString(qa.ExecuteScalar(String.Format("select PaymentCode from Payment where PaymentID = '{0}' and ProjectCode='{1}'", VoucherID, ProjectCode)));
                        }
                        finally
                        {
                            qa.Dispose();
                        }

                        //删除请款
                        if (PaymentCode != "")
                        {
                            dao.EntityName = "Standard_Payment";
                            EntityData entityP = DAL.EntityDAO.PaymentDAO.GetStandard_PaymentByCode(PaymentCode);
                            if (entityP.HasRecord())
                            {
                                dao.DeleteAllRow(entityP);
                                dao.DeleteEntity(entityP);
                            }
                            entityP.Dispose();
                        }

                        //取系统的付款单号
                        string PayoutCode = "";
                        qa = new Rms.ORMap.QueryAgent();
                        try
                        {
                            PayoutCode = BLL.ConvertRule.ToString(qa.ExecuteScalar(String.Format("select PayoutCode from Payout where PayoutID = '{0}' and ProjectCode='{1}'", VoucherID, ProjectCode)));
                        }
                        finally
                        {
                            qa.Dispose();
                        }

                        //删除付款
                        if (PayoutCode != "")
                        {
                            dao.EntityName = "Standard_Payout";
                            EntityData entityP = DAL.EntityDAO.PaymentDAO.GetStandard_PayoutByCode(PayoutCode);
                            if (entityP.HasRecord())
                            {
                                dao.DeleteAllRow(entityP);
                                dao.DeleteEntity(entityP);
                            }
                            entityP.Dispose();
                        }

                        dao.CommitTrans();
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            //RollBackTrans会报错:此 SqlTransaction 已完成;它再也无法使用
                            dao.RollBackTrans();
                        }
                        catch
                        {
                        }

                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 保存
        /// </summary>
        private void SavaData()
        {
            try
            {
                //主表
                EntityData entity = DAL.EntityDAO.PurchaseFlowDAO.GetPurchaseFlowByCode(this.txtPurchaseFlowCode.Value);
                DataRow    dr     = null;
                if (!entity.HasRecord())                 //新增
                {
                    this.txtPurchaseFlowCode.Value = RmsPM.DAL.EntityDAO.SystemManageDAO.GetNewSysCode("PurchaseFlow");

                    dr = entity.CurrentTable.NewRow();
                    dr["PurchaseFlowCode"] = this.txtPurchaseFlowCode.Value;
                    dr["ProjectCode"]      = this.txtProjectCode.Value;
                    dr["CreateDate"]       = DateTime.Today;

                    dr["State"] = 0;

                    entity.CurrentTable.Rows.Add(dr);
                }
                else
                {
                    dr = entity.CurrentRow;
                }

                dr["Purpose"] = this.txtPurpose.Value;

                //明细
                EntityData entityDtl = DAL.EntityDAO.PurchaseFlowDAO.GetPurchaseFlowDetailByCode(this.txtPurchaseFlowDetailCode.Value);
                DataRow    drDtl     = null;
                if (!entityDtl.HasRecord())
                {
                    this.txtPurchaseFlowDetailCode.Value = RmsPM.DAL.EntityDAO.SystemManageDAO.GetNewSysCode("PurchaseFlowDetail");

                    drDtl = entityDtl.CurrentTable.NewRow();
                    drDtl["PurchaseFlowCode"] = this.txtPurchaseFlowCode.Value;

                    entityDtl.CurrentTable.Rows.Add(drDtl);
                }
                else
                {
                    drDtl = entityDtl.CurrentRow;
                }

                drDtl["Money"]       = BLL.ConvertRule.ToDecimal(this.txtMoney.Value);
                drDtl["Description"] = this.txtDescription.Value;

                //提交
                using (StandardEntityDAO dao = new StandardEntityDAO("PurchaseFlow"))
                {
                    dao.BeginTrans();
                    try
                    {
                        //提交主表
                        dao.SubmitEntity(entity);

                        //提交明细
                        dao.EntityName = "PurchaseFlowDetail";
                        dao.SubmitEntity(entityDtl);

                        dao.CommitTrans();
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            //RollBackTrans会报错:此 SqlTransaction 已完成;它再也无法使用
                            dao.RollBackTrans();
                        }
                        catch
                        {
                        }

                        throw ex;
                    }
                }

                entity.Dispose();
                entityDtl.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 23
0
        protected void btnOK_ServerClick(object sender, System.EventArgs e)
        {
            string projectCode    = Request["ProjectCode"] + "";
            string subjectSetCode = BLL.ProjectRule.GetSubjectSetCodeByProject(projectCode);

            try
            {
                if (this.txtFile.PostedFile.FileName == "")
                {
                    Response.Write(Rms.Web.JavaScript.Alert(true, "请选择文件"));
                    return;
                }

                StreamReader m_sr = new StreamReader(this.txtFile.PostedFile.InputStream, System.Text.Encoding.Default);

                //第1行是标题
                if (m_sr.Peek() >= 0)
                {
                    m_sr.ReadLine();
                }

                EntityData cbs = DAL.EntityDAO.CBSDAO.GetCBSByProject(projectCode);
//				EntityData cost = DAL.EntityDAO.CBSDAO.GetCostByProject(projectCode);

                while (m_sr.Peek() >= 0)
                {
                    string s = m_sr.ReadLine();

                    string[] sss = BLL.ImportRule.SplitCsvLine(s);

                    if (sss.Length <= 1)
                    {
                        continue;
                    }

                    string sortID = sss[0];
                    int    re     = 0;
                    Math.DivRem(sortID.Length, 2, out re);
                    if (re == 1)
                    {
                        sortID = "0" + sortID;
                    }


                    DataRow[] drsSelect = cbs.CurrentTable.Select(String.Format("SortID='{0}'", sortID));
                    DataRow   dr        = null;

                    bool isNew = (drsSelect.Length == 0);
                    if (isNew)
                    {
                        dr = cbs.GetNewRecord();
                        string costCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("CostCode");
                        dr["CostCode"]    = costCode;
                        dr["SortID"]      = sortID;
                        dr["ProjectCode"] = projectCode;
                        string parentFullCode = "";
                        int    parentDeep     = 0;
                        string parentCode     = "";
                        string parentSortID   = "";
                        if (sortID.Length >= 2)
                        {
                            parentSortID = sortID.Substring(0, sortID.Length - 2);
                            DataRow[] drsP = cbs.CurrentTable.Select(String.Format("SortID='{0}'", parentSortID));
                            if (drsP.Length > 0)
                            {
                                parentDeep     = (int)drsP[0]["Deep"];
                                parentCode     = (string)drsP[0]["CostCode"];
                                parentFullCode = (string)drsP[0]["FullCode"];
                            }
                        }

                        int deep = parentDeep + 1;
                        dr["Deep"]           = deep;
                        dr["ParentCode"]     = parentCode;
                        dr["SubjectSetCode"] = subjectSetCode;
                        if (parentCode == "")
                        {
                            dr["FullCode"] = costCode;
                        }
                        else
                        {
                            dr["FullCode"] = parentFullCode + "-" + costCode;
                        }

                        cbs.AddNewRecord(dr);

                        /*
                         * DataRow drCost = cost.GetNewRecord();
                         * drCost["CostItemCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("CostItemCode");
                         * drCost["CostCode"] = costCode;
                         * drCost["ProjectCode"] = projectCode;
                         * drCost["Flag"] = -1;
                         * drCost["TotalMoney"] = decimal.Zero;
                         * drCost["ModifyPerson"] = base.user.UserCode;
                         * drCost["ModifyDate"] = DateTime.Now.Date;
                         *
                         * // AccountPoint: 0 不作预算、1 做了预算、 2 不是控制点,是子预算统计上来的
                         *
                         * if ( deep == 1 )
                         *      drCost["AccountPoint"] = 1;
                         * else
                         *      drCost["AccountPoint"] = 0;
                         *
                         * cost.AddNewRecord(drCost);
                         */
                    }
                    else
                    {
                        dr = drsSelect[0];
                    }

                    dr["CostName"] = sss[1];

                    if (sss.Length >= 3)
                    {
                        dr["SubjectCode"] = sss[2];
                    }
                    if (sss.Length >= 4)
                    {
                        dr["CostAllocationDescription"] = sss[3];
                    }
                    if (sss.Length >= 5)
                    {
                        dr["Description"] = sss[4];
                    }
                }

                using (StandardEntityDAO dao = new StandardEntityDAO("CBS"))
                {
                    dao.BeginTrans();
                    try
                    {
                        dao.SubmitEntity(cbs);

                        /*
                         * dao.EntityName = "Cost";
                         * dao.SubmitEntity(cost);
                         */

                        dao.CommitTrans();
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            dao.RollBackTrans();
                        }
                        catch
                        {
                        }

                        throw ex;
                    }
                }

                cbs.Dispose();
//				cost.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(JavaScript.Alert(true, "导入出错:" + ex.Message));
                return;
            }

            Response.Write(JavaScript.ScriptStart);
            Response.Write(JavaScript.Alert(false, "导入完成 !"));
            Response.Write(JavaScript.OpenerReload(false));
            Response.Write("window.close();");
            Response.Write(JavaScript.ScriptEnd);
        }
Ejemplo n.º 24
0
        public string SubmitGradeData()
        {
            using (StandardEntityDAO dao = new StandardEntityDAO("GradeMessage"))
            {
                try
                {
                    //string GradeMessageCode = Request["GradeMessageCode"] + "";
                    //string act = Request["act"] + "";
                    string msg = "";

                    if (msg != "")
                    {
                        Response.Write(Rms.Web.JavaScript.Alert(true, msg));
                        return(msg);
                    }
                    dao.BeginTrans();



                    //Grade gv = new Grade();
                    //gv.GradeMessageCode = this.GradeMessageCode;
                    //DataTable Gradedt = gv.GetGrades();
                    string GradeMessageFilter = "";

                    //取的所有使用到的MessageCode
                    for (int i = 0; i < this.Repeater1.Items.Count; i++)
                    {
                        //if (((Label)Repeater1.Items[i].FindControl("Labelsubtotal")).Text == "1")
                        //{
                        //    continue;
                        //}
                        if (((Label)Repeater1.Items[i].FindControl("LabelFlag")).Text == "1")
                        {
                            int ColumnCount = System.Convert.ToInt32(((Label)Repeater1.Items[i].FindControl("LblColumnCount")).Text);

                            for (int ColumnIndex = 0; ColumnIndex < ColumnCount; ColumnIndex++)
                            {
                                if (ColumnIndex != ColumnCount - 1)
                                {
                                    GradeMessageFilter = GradeMessageFilter + "'" + ((Label)Repeater1.Items[i].FindControl("GradeMessageCode" + (ColumnIndex + 1))).Text + "',";
                                }
                                else
                                {
                                    GradeMessageFilter = GradeMessageFilter + "'" + ((Label)Repeater1.Items[i].FindControl("GradeMessageCode" + (ColumnIndex + 1))).Text + "'";
                                }
                            }
                        }
                        break;
                    }

                    if (GradeMessageFilter != "")
                    {
                        BiddingGrade cBiddingGrade = new BiddingGrade();
                        cBiddingGrade.BiddingGradeMessageCode = GradeMessageFilter;
                        DataTable dtGrade = cBiddingGrade.GetBiddings();

                        for (int i = 0; i < Repeater1.Items.Count; i++)
                        {
                            if (((Label)Repeater1.Items[i].FindControl("LabelFlag")).Text == "0")
                            {
                                continue;
                            }
                            int ColumnCount = System.Convert.ToInt32(((Label)Repeater1.Items[i].FindControl("LblColumnCount")).Text);

                            for (int ColumnIndex = 0; ColumnIndex < ColumnCount; ColumnIndex++)
                            {
                                string GradeMessageCode = ((Label)Repeater1.Items[i].FindControl("GradeMessageCode" + (ColumnIndex + 1))).Text;
                                if (dtGrade.Select("BiddingGradeMessageCode='" + GradeMessageCode + "'").Length != 0)
                                {
                                    cBiddingGrade.BiddingGradeCode = ((Label)Repeater1.Items[i].FindControl("Code" + (ColumnIndex + 1))).Text.Trim();
                                    cBiddingGrade.GradePoint       = System.Convert.ToInt32(((TextBox)Repeater1.Items[i].FindControl("Point" + (ColumnIndex + 1))).Text.Trim());
                                    if (cBiddingGrade.BiddingGradeCode != "")
                                    {
                                        cBiddingGrade.BiddingGradeUpdate();
                                    }
                                }
                                else
                                {
                                    cBiddingGrade.BiddingGradeCode             = "";
                                    cBiddingGrade.BiddingConsiderDiathesisCode = ((Label)Repeater1.Items[i].FindControl("LabelCode")).Text.Trim();
                                    cBiddingGrade.BiddingGradeMessageCode      = GradeMessageCode;
                                    cBiddingGrade.GradePoint = System.Convert.ToInt32(((TextBox)Repeater1.Items[i].FindControl("Point" + (ColumnIndex + 1))).Text.Trim());
                                    cBiddingGrade.BiddingGradeAdd();
                                }
                            }
                        }
                    }
                    dao.CommitTrans();
                    return("");
                }
                catch (Exception ex)
                {
                    dao.RollBackTrans();
                    Response.Write(Rms.Web.JavaScript.Alert(true, ex.Message));
                    throw ex;
                    return(ex.Message);
                }
            }
        }
Ejemplo n.º 25
0
        protected void btnSave_ServerClick(object sender, System.EventArgs e)
        {
            try
            {
                string projectCode = Request["ProjectCode"] + "";
                if (this.txtFile.PostedFile.FileName == "")
                {
                    Response.Write(Rms.Web.JavaScript.Alert(true, "请选择文件!"));
                    return;
                }

                if (this.txtFile.PostedFile.ContentLength == 0)
                {
                    Response.Write(Rms.Web.JavaScript.Alert(true, "该文件是空文件!"));
                    return;
                }

                if (this.inputSystemGroupPayout.Value == "")
                {
                    Response.Write(Rms.Web.JavaScript.Alert(true, "请选择付款类型!"));
                    return;
                }

                if (this.inputSystemGroupPayment.Value == "")
                {
                    Response.Write(Rms.Web.JavaScript.Alert(true, "请选择请款类型!"));
                    return;
                }

                try
                {
                    EntityData CBS = DAL.EntityDAO.CBSDAO.GetCBSByProject(projectCode);

                    //检查费用项是否已建立
                    if (!CBS.HasRecord())
                    {
                        throw new Exception("未建立费用项,不能导入凭证");
                    }

                    /*----------------------------记录要导入的凭证号(可能有多个)--------------------------*/
                    DataTable tbV = new DataTable();
                    tbV.Columns.Add("VoucherCode");
                    tbV.Columns.Add("VoucherID");

                    ArrayList arr = new ArrayList();

                    StreamReader m_sr = new StreamReader(this.txtFile.PostedFile.InputStream, System.Text.Encoding.Default);

                    // 第一行跳过
                    m_sr.ReadLine();
                    string strTemp;
                    while ((strTemp = m_sr.ReadLine()) != null)
                    {
                        arr.Add(strTemp);

                        //记录凭证号
                        string [] sFields = strTemp.Split(new char[] { ',' });
                        for (int i = 0; i < sFields.Length; i++)
                        {
                            sFields[i] = sFields[i].Replace("\"", "");
                        }

                        string VoucherID = "B" + sFields[2];
                        if (tbV.Select("VoucherID='" + VoucherID + "'").Length == 0)
                        {
                            string VoucherCode = "";

                            //取系统的凭证号
                            QueryAgent qa = new Rms.ORMap.QueryAgent();
                            try
                            {
                                VoucherCode = BLL.ConvertRule.ToString(qa.ExecuteScalar(String.Format("select VoucherCode from Voucher where VoucherID = '{0}' and ProjectCode='{1}'", VoucherID, projectCode)));
                            }
                            finally
                            {
                                qa.Dispose();
                            }

                            DataRow drNew = tbV.NewRow();
                            drNew["VoucherCode"] = VoucherCode;
                            drNew["VoucherID"]   = VoucherID;
                            tbV.Rows.Add(drNew);
                        }
                    }
                    m_sr.Close();

                    //删除老的凭证、请款、付款
                    foreach (DataRow drV in tbV.Rows)
                    {
                        //事务处理
                        using (StandardEntityDAO dao = new StandardEntityDAO("Voucher"))
                        {
                            dao.BeginTrans();
                            try
                            {
                                string VoucherCode = drV["VoucherCode"].ToString();
                                string VoucherID   = drV["VoucherID"].ToString();

                                if (VoucherCode != "")
                                {
                                    //删除凭证
                                    dao.EntityName = "Standard_Voucher";
                                    EntityData entityV = DAL.EntityDAO.PaymentDAO.GetStandard_VoucherByCode(VoucherCode);
                                    if (entityV.HasRecord())
                                    {
                                        dao.DeleteAllRow(entityV);
                                        dao.DeleteEntity(entityV);
                                    }
                                    entityV.Dispose();
                                }

                                //取系统的请款单号
                                string     PaymentCode = "";
                                QueryAgent qa          = new Rms.ORMap.QueryAgent();
                                try
                                {
                                    PaymentCode = BLL.ConvertRule.ToString(qa.ExecuteScalar(String.Format("select PaymentCode from Payment where PaymentID = '{0}' and ProjectCode='{1}'", VoucherID, projectCode)));
                                }
                                finally
                                {
                                    qa.Dispose();
                                }

                                //删除请款
                                if (PaymentCode != "")
                                {
                                    dao.EntityName = "Standard_Payment";
                                    EntityData entityP = DAL.EntityDAO.PaymentDAO.GetStandard_PaymentByCode(PaymentCode);
                                    if (entityP.HasRecord())
                                    {
                                        dao.DeleteAllRow(entityP);
                                        dao.DeleteEntity(entityP);
                                    }
                                    entityP.Dispose();
                                }

                                //取系统的付款单号
                                string PayoutCode = "";
                                qa = new Rms.ORMap.QueryAgent();
                                try
                                {
                                    PayoutCode = BLL.ConvertRule.ToString(qa.ExecuteScalar(String.Format("select PayoutCode from Payout where PayoutID = '{0}' and ProjectCode='{1}'", VoucherID, projectCode)));
                                }
                                finally
                                {
                                    qa.Dispose();
                                }

                                //删除付款
                                if (PayoutCode != "")
                                {
                                    dao.EntityName = "Standard_Payout";
                                    EntityData entityP = DAL.EntityDAO.PaymentDAO.GetStandard_PayoutByCode(PayoutCode);
                                    if (entityP.HasRecord())
                                    {
                                        dao.DeleteAllRow(entityP);
                                        dao.DeleteEntity(entityP);
                                    }
                                    entityP.Dispose();
                                }

                                dao.CommitTrans();
                            }
                            catch (Exception ex)
                            {
                                try
                                {
                                    //RollBackTrans会报错:此 SqlTransaction 已完成;它再也无法使用
                                    dao.RollBackTrans();
                                }
                                catch
                                {
                                }

                                throw ex;
                            }
                        }
                    }

                    EntityData voucher = new EntityData("Standard_Voucher");
                    EntityData payout  = new EntityData("Standard_Payout");
                    EntityData payment = new EntityData("Standard_Payment");

                    voucher.Tables["Voucher"].Columns.Add("SupplierCode");
                    voucher.Tables["Voucher"].Columns.Add("SupplierName");

                    long LastVoucherCode = BLL.ConvertRule.ToLong(BLL.PaymentRule.GetNextVoucherCode()) - 1;

                    foreach (string val in arr)
                    {
                        string [] sFields = val.Split(new char[] { ',' });
                        for (int i = 0; i < sFields.Length; i++)
                        {
                            sFields[i] = sFields[i].Replace("\"", "");
                        }
                        string std  = sFields[0];
                        string type = sFields[1];

                        if ((type != "2") && (type != "4") && (type != "5"))
                        {
                            throw new Exception("只能导入付出凭证");
                        }

//						if ( type.Length == 1 )
//							type = "0" + type;

                        string voucherID = "B" + sFields[2];

                        // 凭证表
                        string  voucherCode = "";
                        DataRow drV         = null;
                        voucher.SetCurrentTable("Voucher");
                        DataRow[] drVs = voucher.CurrentTable.Select(String.Format("VoucherID='{0}'", voucherID));
                        if (drVs.Length > 0)
                        {
                            drV         = drVs[0];
                            voucherCode = (string)drV["VoucherCode"];
                        }
                        else
                        {
                            drV = voucher.GetNewRecord();
                            LastVoucherCode++;
                            voucherCode        = LastVoucherCode.ToString();
                            drV["VoucherCode"] = voucherCode;

                            drV["ProjectCode"] = projectCode;
                            drV["VoucherID"]   = voucherID;
                            drV["VoucherType"] = type;
                            drV["MakeDate"]    = std;
                            drV["Status"]      = 2;
                            drV["Accountant"]  = user.UserCode;
                            drV["AccountDate"] = std;
                            drV["IsExported"]  = 1;
                            drV["ExportDate"]  = DateTime.Now;
                            drV["CheckPerson"] = user.UserCode;
                            drV["CheckDate"]   = std;

                            voucher.AddNewRecord(drV);
                        }

                        //用友的供应商代码
                        string UFSupplierCode = sFields[18];
                        string SupplierCode   = "";
                        if (UFSupplierCode != "")
                        {
                            //按用友代码取系统代码
                            QueryAgent qa = new Rms.ORMap.QueryAgent();
                            try
                            {
                                SupplierCode = BLL.ConvertRule.ToString(qa.ExecuteScalar(String.Format("select SupplierCode from Supplier where U8Code = '{0}'", UFSupplierCode)));
                            }
                            finally
                            {
                                qa.Dispose();
                            }
                        }
                        drV["SupplierCode"] = SupplierCode;

                        //供应商名称
                        string supplierName = "";
                        if (sFields.Length > 66)
                        {
                            supplierName = sFields[65];
                        }
                        drV["SupplierName"] = supplierName;

                        //凭证分录  begin-----------------------------------------------------
                        voucher.SetCurrentTable("VoucherDetail");
                        DataRow drVD = voucher.GetNewRecord();
                        drVD["VoucherDetailCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("VoucherDetailCode");
                        drVD["VoucherCode"]       = voucherCode;
                        drVD["Summary"]           = sFields[4];

                        drVD["SubjectCode"] = sFields[5];
                        if (Rms.Check.StringCheck.IsNumber(sFields[6]))
                        {
                            drVD["DebitMoney"] = sFields[6];
                        }
                        else
                        {
                            drVD["DebitMoney"] = decimal.Zero;
                        }

                        if (Rms.Check.StringCheck.IsNumber(sFields[7]))
                        {
                            drVD["CrebitMoney"] = sFields[7];
                        }
                        else
                        {
                            drVD["CrebitMoney"] = decimal.Zero;
                        }

                        drVD["BillNo"]      = sFields[13];
                        drVD["ProjectCode"] = projectCode;
                        drVD["RelaType"]    = "付款";

                        //用友的项目代码,即系统的项目代码
                        drVD["UFProjectCode"] = sFields[20];

                        //供应商代码
                        drVD["CustCode"] = SupplierCode;

                        voucher.AddNewRecord(drVD);

                        //凭证分录  end-----------------------------------------------------
                    }
                    m_sr.Close();

                    // 补付款和请款
                    voucher.SetCurrentTable("Voucher");
                    foreach (DataRow drV in voucher.Tables["Voucher"].Rows)
                    {
                        string voucherCode = (string)drV["VoucherCode"];
                        string voucherID   = (string)drV["VoucherID"];

                        // 付款
                        payout.SetCurrentTable("Payout");
                        DataRow drP        = payout.GetNewRecord();
                        string  payoutCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("PayoutCode");

                        drP["PayoutCode"]  = payoutCode;
                        drP["ProjectCode"] = projectCode;
                        drP["PayoutDate"]  = drV["MakeDate"];

                        //现金的科目以“101”开头
                        if (voucher.Tables["VoucherDetail"].Select(String.Format(" VoucherCode='{0}' and SubjectCode like '101' ", voucherCode)).Length > 0)
                        {
                            drP["PaymentType"] = "现金";
                        }
                        else
                        {
                            drP["PaymentType"] = "支票";
                        }

                        drP["Payer"]      = "补单";
                        drP["SupplyCode"] = drV["SupplierCode"];
                        drP["SupplyName"] = drV["SupplierName"];

                        drP["PayoutID"] = voucherID;
                        DataRow[] drsCre      = voucher.Tables["VoucherDetail"].Select(String.Format(" VoucherCode='{0}' and CrebitMoney>0 ", voucherCode));
                        decimal   payoutMoney = BLL.MathRule.SumColumn(drsCre, "CrebitMoney");
                        drP["Money"] = payoutMoney;

                        // 凭证的总金额项
                        drV["TotalMoney"] = payoutMoney;

                        if (drsCre.Length > 0)
                        {
                            drP["SubjectCode"] = drsCre[0]["SubjectCode"];
                        }

                        drP["Status"]        = 1;
                        drP["CheckPerson"]   = user.UserCode;
                        drP["CheckDate"]     = drV["MakeDate"];
                        drP["GroupCode"]     = this.inputSystemGroupPayout.Value;
                        drP["IsApportioned"] = 0;
                        payout.AddNewRecord(drP);

                        // 请款
                        payment.SetCurrentTable("Payment");
                        DataRow drPM        = payment.GetNewRecord();
                        string  paymentCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("PaymentCode");
                        drPM["PaymentCode"] = paymentCode;
                        drPM["ProjectCode"] = projectCode;
                        drPM["PaymentID"]   = voucherID;
                        drPM["VoucherID"]   = voucherID;

                        drPM["ApplyPerson"] = user.UserCode;
                        drPM["ApplyDate"]   = drV["MakeDate"];
                        drPM["Payer"]       = "补单";
                        drPM["PayDate"]     = drV["MakeDate"];
                        drPM["Money"]       = payoutMoney;

                        drPM["CheckPerson"] = user.UserCode;
                        drPM["CheckDate"]   = drV["MakeDate"];
                        drPM["IsContract"]  = 0;
                        drPM["Status"]      = 2;
                        drPM["IsApportion"] = 0;
                        drPM["SupplyCode"]  = drV["SupplierCode"];
                        drPM["SupplyName"]  = drV["SupplierName"];
                        drPM["GroupCode"]   = this.inputSystemGroupPayment.Value;
                        payment.AddNewRecord(drPM);



                        // 付款请款分项
                        payout.SetCurrentTable("PayoutItem");
                        payment.SetCurrentTable("PaymentItem");
                        foreach (DataRow drVD in voucher.Tables["VoucherDetail"].Select(String.Format(" VoucherCode='{0}' and DebitMoney <> 0 ", voucherCode)))
                        {
                            string subjectCode = BLL.ConvertRule.ToString(drVD["SubjectCode"]);

                            DataRow drPMItem        = payment.GetNewRecord();
                            string  paymentItemCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("PaymentItemCode");
                            drPMItem["PaymentItemCode"] = paymentItemCode;
                            drPMItem["PaymentCode"]     = paymentCode;
                            drPMItem["ItemMoney"]       = drVD["DebitMoney"];
                            drPMItem["CostCode"]        = GetCostCode(subjectCode, CBS);
                            drPMItem["Summary"]         = drVD["Summary"];
                            drPMItem["AlloType"]        = "P";
                            payment.AddNewRecord(drPMItem);

                            DataRow drPD = payout.GetNewRecord();
                            drPD["PayoutItemCode"]  = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("PayoutItemCode");
                            drPD["PayoutCode"]      = payoutCode;
                            drPD["PayoutMoney"]     = drVD["DebitMoney"];
                            drPD["SubjectCode"]     = subjectCode;
                            drPD["Remark"]          = drVD["Summary"];
                            drPD["AlloType"]        = "P";
                            drPD["IsManualAlloc"]   = 0;
                            drPD["PaymentItemCode"] = paymentItemCode;
                            payout.AddNewRecord(drPD);

                            // 凭证的相关编码
                            drVD["RelaCode"] = payoutCode;
                        }
                    }

                    DAL.EntityDAO.PaymentDAO.SubmitAllStandard_Payout(payout);
                    DAL.EntityDAO.PaymentDAO.SubmitAllStandard_Voucher(voucher);
                    DAL.EntityDAO.PaymentDAO.SubmitAllStandard_Payment(payment);

                    voucher.Dispose();
                    payout.Dispose();
                    payment.Dispose();
                    CBS.Dispose();


                    Response.Write(JavaScript.ScriptStart);
                    Response.Write(JavaScript.Alert(false, "导入成功 !"));
                    Response.Write(JavaScript.OpenerReload(false));
                    Response.Write("window.close();");
                    Response.Write(JavaScript.ScriptEnd);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(JavaScript.Alert(true, "导入失败:" + ex.Message));
            }
        }
Ejemplo n.º 26
0
        public static void PBSTypeCopyByProject(string srcProjectCode, string dstProjectCode)
        {
            Exception exception;

            try
            {
                using (StandardEntityDAO ydao = new StandardEntityDAO("PBSType"))
                {
                    ydao.BeginTrans();
                    try
                    {
                        EntityData entitydata = new EntityData("PBSType");
                        ydao.FillEntity(SqlManager.GetSqlStruct("PBSType", "SelectByProjectCode").SqlString, "@ProjectCode", dstProjectCode, entitydata, "PBSType");
                        ydao.DeleteAllRow(entitydata);
                        ydao.DeleteEntity(entitydata);
                        DataTable table = new DataTable();
                        table.Columns.Add("OldPBSTypeCode", typeof(string));
                        table.Columns.Add("NewPBSTypeCode", typeof(string));
                        EntityData data2 = new EntityData("PBSType");
                        ydao.FillEntity(SqlManager.GetSqlStruct("PBSType", "SelectByProjectCode").SqlString, "@ProjectCode", srcProjectCode, data2, "PBSType");
                        int num = 1;
                        for (DataRow[] rowArray = data2.CurrentTable.Select("deep=" + num.ToString()); rowArray.Length > 0; rowArray = data2.CurrentTable.Select("deep=" + num.ToString()))
                        {
                            foreach (DataRow row in rowArray)
                            {
                                DataRow row2       = entitydata.CurrentTable.NewRow();
                                string  newSysCode = SystemManageDAO.GetNewSysCode("PBSTypeCode");
                                row2["PBSTypeCode"] = newSysCode;
                                row2["ProjectCode"] = dstProjectCode;
                                row2["PBSTypeName"] = ConvertRule.ToString(row["PBSTypeName"]);
                                row2["Description"] = ConvertRule.ToString(row["Description"]);
                                row2["Deep"]        = ConvertRule.ToInt(row["Deep"]);
                                row2["SortID"]      = ConvertRule.ToInt(row["SortID"]);
                                DataRow row3 = table.NewRow();
                                row3["OldPBSTypeCode"] = ConvertRule.ToString(row["PBSTypeCode"]);
                                row3["NewPBSTypeCode"] = newSysCode;
                                table.Rows.Add(row3);
                                string text2 = ConvertRule.ToString(row["ParentCode"]);
                                if (text2 != "")
                                {
                                    DataRow[] rowArray2 = table.Select("OldPBSTypeCode='" + text2 + "'");
                                    if (rowArray2.Length > 0)
                                    {
                                        text2 = ConvertRule.ToString(rowArray2[0]["NewPBSTypeCode"]);
                                    }
                                }
                                string text3 = "";
                                if (text2 != "")
                                {
                                    DataRow[] rowArray3 = entitydata.CurrentTable.Select("PBSTypeCode='" + text2 + "'");
                                    if (rowArray3.Length > 0)
                                    {
                                        text3 = ConvertRule.ToString(rowArray3[0]["FullID"]);
                                    }
                                }
                                string text4 = newSysCode;
                                if (text3 != "")
                                {
                                    text4 = text3 + "-" + text4;
                                }
                                row2["ParentCode"] = text2;
                                row2["FullID"]     = text4;
                                entitydata.CurrentTable.Rows.Add(row2);
                            }
                            num++;
                        }
                        ydao.InsertEntity(entitydata);
                        ydao.CommitTrans();
                        data2.Dispose();
                        entitydata.Dispose();
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        try
                        {
                            ydao.RollBackTrans();
                        }
                        catch
                        {
                        }
                        throw exception;
                    }
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                throw exception;
            }
        }
Ejemplo n.º 27
0
 /// ****************************************************************************
 /// <summary>
 /// 工具栏事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// ****************************************************************************
 override protected void WorkFlowToolbar1_ToolbarCommand(object sender, System.EventArgs e)
 {
     /****************************************************************************/
     using (StandardEntityDAO dao = new StandardEntityDAO("Leave"))
     {
         dao.BeginTrans();
         try
         {
             /***********************************************************/
             //签收
             if (WorkFlowToolbar1.CommandType == ToolbarCommandType.SignIn)
             {
                 WorkFlowToolbar1.SignIn(dao);
                 InitPage();
                 if (WorkFlowToolbar1.GetModuleState("Opinion4") == ModuleState.Operable)
                 {
                     WorkFlowToolbar1.SaveCasePropertyValue("用户类别", user.GetOperationType());
                 }
             }
             //发送
             if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Send)
             {
                 //Response.Write(Rms.Web.JavaScript.WriteJS("ggggg"));
                 try
                 {
                     DataSubmit(dao);
                     //如果为发起,则将状态改为"中标单位审批中"
                     if (WorkFlowToolbar1.GetModuleState("BaseWrite") == ModuleState.Operable)
                     {
                         BLL.BiddingSystem.Set_BiddingState("41", this.BiddingMessageModify1.BiddingCode);
                     }
                     if (WorkFlowToolbar1.GetModuleState("End") == ModuleState.Eyeable)
                     {
                         BLL.BiddingSystem.Set_BiddingState("42", this.BiddingMessageModify1.BiddingCode);
                     }
                 }
                 catch (Exception ex)
                 {
                     Response.Write(Rms.Web.JavaScript.Alert(true, ex.Message));
                 }
                 WorkFlowToolbar1.Send();
             }
             //退回
             if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Back)
             {
                 DataSubmit(dao);
                 WorkFlowToolbar1.Back();
             }
             //收回
             if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Return)
             {
                 WorkFlowToolbar1.Return();
             }
             //送经办人
             if (WorkFlowToolbar1.CommandType == ToolbarCommandType.BackTop)
             {
                 DataSubmit(dao);
                 WorkFlowToolbar1.BackTop();
             }
             //保存意见
             if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Opinion)
             {
                 WorkFlowToolbar1.SaveOpinion();
                 this.WorkFlowCaseState1.ControlDataBind();
             }
             //保存
             if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Save)
             {
                 DataSubmit(dao);
                 WorkFlowToolbar1.Save();
                 WorkFlowPropertySave();
                 if (!this.WorkFlowToolbar1.IsNew)
                 {
                     Response.Write(Rms.Web.JavaScript.ScriptStart);
                     Response.Write(Rms.Web.JavaScript.OpenerReload(false));
                     Response.Write(Rms.Web.JavaScript.WinClose(false));
                     Response.Write(Rms.Web.JavaScript.ScriptEnd);
                 }
             }
             //完成
             if (WorkFlowToolbar1.CommandType == ToolbarCommandType.TaskFinish)
             {
                 DataSubmit(dao);
                 if (WorkFlowToolbar1.GetModuleState("End") == ModuleState.Eyeable)
                 {
                     BLL.BiddingSystem.Set_BiddingState("42", this.BiddingMessageModify1.BiddingCode);
                 }
                 WorkFlowToolbar1.TaskFinish();
             }
             //结束
             if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Finish)
             {
                 DataSubmit(dao);
                 if (WorkFlowToolbar1.GetModuleState("End") == ModuleState.Eyeable)
                 {
                     BLL.BiddingSystem.Set_BiddingState("42", this.BiddingMessageModify1.BiddingCode);
                 }
                 WorkFlowToolbar1.Finish();
             }
             //抄送
             if (WorkFlowToolbar1.CommandType == ToolbarCommandType.MakeCopy)
             {
                 DataSubmit(dao);
                 WorkFlowToolbar1.MakeCopy();
             }
             //删除
             if (WorkFlowToolbar1.CommandType == ToolbarCommandType.Delete)
             {
                 WorkFlowToolbar1.Delete();
                 BLL.BiddingSystem.Set_BiddingState("3", this.BiddingMessageModify1.BiddingCode, dao);
             }
             /*******************************************************/
             dao.CommitTrans();
         }
         catch (Exception ex)
         {
             dao.RollBackTrans();
             throw ex;
         }
     }
     /*******************************************************************/
 }