Пример #1
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;
     }
 }
Пример #2
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;
         }
     }
 }
Пример #3
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;
         }
     }
 }
Пример #4
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);
        }
Пример #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;
            }
        }
Пример #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;
                }
            }
        }
Пример #7
0
 /// <summary>
 /// 完成
 /// </summary>
 virtual protected void ToolBarTaskFinish(StandardEntityDAO dao)
 {
     if (DataSubmit(dao))
     {
         this.up_wftToolbar.TaskFinish();
     }
     else
     {
         dao.RollBackTrans();
         this.up_wftToolbar.IsNew = false;
     }
 }
Пример #8
0
 /// <summary>
 /// 退返经办人
 /// </summary>
 virtual protected void ToolBarBackTop(StandardEntityDAO dao)
 {
     if (DataSubmit(dao) && OpinionDataSubmit(dao))
     {
         this.up_wftToolbar.BackTop();
     }
     else
     {
         dao.RollBackTrans();
         this.up_wftToolbar.IsNew = false;
     }
 }
Пример #9
0
 /// <summary>
 /// 结束
 /// </summary>
 virtual protected void ToolBarFinish(StandardEntityDAO dao)
 {
     if (DataSubmit(dao, true))
     {
         wftToolbar.Finish();
     }
     else
     {
         dao.RollBackTrans();
         wftToolbar.IsNew = false;
     }
 }
Пример #10
0
 /// <summary>
 /// 抄送
 /// </summary>
 virtual protected void ToolBarMakeCopy(StandardEntityDAO dao)
 {
     if (DataSubmit(dao))
     {
         wftToolbar.MakeCopy();
     }
     else
     {
         dao.RollBackTrans();
         wftToolbar.IsNew = false;
     }
 }
Пример #11
0
 /// <summary>
 /// 流程删除
 /// </summary>
 /// <param name="dao">流程删除</param>
 virtual protected void ToolBarDelete(StandardEntityDAO dao)
 {
     if (this.up_ucOperationControl.Delete(dao))
     {
         this.up_wftToolbar.Delete();
     }
     else
     {
         dao.RollBackTrans();
         this.up_wftToolbar.IsNew = false;
     }
 }
Пример #12
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;
            }
        }
Пример #13
0
 /// <summary>
 /// 发送
 /// </summary>
 virtual protected void ToolBarSend(StandardEntityDAO dao)
 {
     if (DataSubmit(dao, true))
     {
         wftToolbar.Send();
         WorkFlowPropertySave();
     }
     else
     {
         dao.RollBackTrans();
         wftToolbar.IsNew = false;
     }
 }
Пример #14
0
 /// <summary>
 /// 抄送
 /// </summary>
 virtual protected void ToolBarMakeCopy(StandardEntityDAO dao)
 {
     if (DataSubmit(dao) && OpinionDataSubmit(dao))
     {
         this.up_wftToolbar.MakeCopy();
         WorkFlowPropertySave();
     }
     else
     {
         dao.RollBackTrans();
         this.up_wftToolbar.IsNew = false;
     }
 }
Пример #15
0
 /// <summary>
 /// 作废
 /// </summary>
 virtual protected void ToolBarBlankOut(StandardEntityDAO dao)
 {
     if (OpinionDataSubmit(dao, true) && DataSubmit(dao, true) && this.up_ucOperationControl.BlankOut(dao))
     {
         this.up_wftToolbar.BlankOut();
         this.up_wftToolbar.SaveOpinion();
         this.up_wfcCaseState.SubmitData();
     }
     else
     {
         dao.RollBackTrans();
         this.up_wftToolbar.IsNew = false;
     }
 }
Пример #16
0
 /// <summary>
 /// 结束
 /// </summary>
 virtual protected void ToolBarFinish(StandardEntityDAO dao)
 {
     if (OpinionDataSubmit(dao, true) && DataSubmit(dao, true))
     {
         this.up_wftToolbar.Finish();
         this.up_wftToolbar.SaveOpinion();
         this.up_wfcCaseState.SubmitData();
     }
     else
     {
         dao.RollBackTrans();
         this.up_wftToolbar.IsNew = false;
     }
 }
Пример #17
0
 /// <summary>
 /// 发送
 /// </summary>
 virtual protected void ToolBarSend(StandardEntityDAO dao)
 {
     if (DataSubmit(dao, true) && OpinionDataSubmit(dao))
     {
         this.up_wftToolbar.Send();
         if (this.up_ucOperationControl.State == ModuleState.Operable)
         {
             this.up_ucOperationControl.ChangeStatusWhenSend(dao);
         }
         WorkFlowPropertySave();
         this.up_wfcCaseState.SubmitData();
     }
     else
     {
         dao.RollBackTrans();
         this.up_wftToolbar.IsNew = false;
     }
 }
Пример #18
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
                    {
                    }
                }
            }
            /*******************************************************************/
        }
Пример #19
0
 /// <summary>
 /// 保存
 /// </summary>
 virtual protected void ToolBarSave(StandardEntityDAO dao)
 {
     if (DataSubmit(dao))
     {
         wftToolbar.Save();
         WorkFlowPropertySave();
         if (!this.wftToolbar.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);
         }
     }
     else
     {
         dao.RollBackTrans();
         wftToolbar.IsNew = false;
     }
 }
Пример #20
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;
     }
 }
Пример #21
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));
         }
     }
 }
Пример #22
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;
            }
        }
Пример #23
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;
                }
            }
            /*******************************************************************/
        }
Пример #24
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));
            }
        }
Пример #25
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;
         }
     }
 }
Пример #26
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;
            }
        }
Пример #27
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;
            }
        }
Пример #28
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;
            }
        }
Пример #29
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;
                }
            }
            /*******************************************************************/
        }
Пример #30
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;
                }
            }
            /*******************************************************************/
        }