Ejemplo n.º 1
0
    /// <summary>
    /// 根据编号获取特定合同记录
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public static ContractApply GetContractApplyByID(int id)
    {
        SqlConnection conn = new SqlConnection(connString);
        SqlCommand    cmd  = new SqlCommand("SELECT * FROM [ContractApplies] WHERE [ApplyID] = @ApplyID", conn);

        cmd.Parameters.Add("@ApplyID", SqlDbType.Int).Value = id;
        conn.Open();
        SqlDataReader sdr = cmd.ExecuteReader();
        ContractApply ci  = null;

        if (sdr.Read())
        {
            ci                  = new ContractApply();
            ci.staffName        = (string)sdr["StaffName"];
            ci.department       = (string)sdr["Department"];
            ci.projectName      = (string)sdr["ProjectName"];
            ci.projectCode      = (string)sdr["ProjectCode"];
            ci.contractName     = (string)sdr["ContractName"];
            ci.money            = Convert.ToDouble(sdr["Money"]);
            ci.partyBName       = (string)sdr["PartyBName"];
            ci.partyBAddress    = (string)sdr["PartyBAddress"];
            ci.partyBContact    = (string)sdr["PartyBContact"];
            ci.partyBTelephone  = (string)sdr["PartyBTelephone"];
            ci.businessLicense  = (bool)sdr["BusinessLicense"];
            ci.industoryLicense = (bool)sdr["IndustoryLicense"];
            ci.others           = (string)sdr["Others"];
            ci.ApproveProcess   = sdr["ApproveProcess"] == DBNull.Value ? "" : (string)sdr["ApproveProcess"];
        }
        sdr.Close();
        conn.Close();
        return(ci);
    }
Ejemplo n.º 2
0
    protected void confirmButton_Click(object sender, EventArgs e)
    {
        ContractApply ci = new ContractApply();

        ci.StaffName        = staffName.Text;
        ci.Department_str   = department.Text;
        ci.ContractName     = contractName.Value;
        ci.ProjectCode      = projectCode.Text;
        ci.ProjectName      = projectNameList.SelectedValue;
        ci.Money            = Convert.ToDouble(money.Text);
        ci.PartyBName       = partyBName.Value;
        ci.PartyBAddress    = partyBAddress.Value;
        ci.PartyBContact    = partyBContact.Value;
        ci.PartyBTelephone  = partyBTelephone.Value;
        ci.BusinessLicense  = businessLicense.Checked;
        ci.IndustoryLicense = industoryLicense.Checked;
        ci.ApproveProcess   = "";
        if (others.Checked)
        {
            ci.Others = Request["otherInfo"];
        }
        else
        {
            ci.Others = "";
        }

        Users usr = (Users)Session["Identify"];

        ContractApply.SetContractApplyByID(-1, ci, usr.UserID);
        Response.Redirect("~/Account/ApplyListPage.aspx");
    }
Ejemplo n.º 3
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List <ContractApplyInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <ContractApplyInfo> list = new List <ContractApplyInfo>();

            Query q = ContractApply.CreateQuery();

            q.PageIndex = pPageIndex;
            q.PageSize  = pPageSize;
            q.ORDER_BY(pSortExpression, pOrderBy.ToString());
            ContractApplyCollection collection = new  ContractApplyCollection();

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (ContractApply contractApply  in collection)
            {
                ContractApplyInfo contractApplyInfo = new ContractApplyInfo();
                LoadFromDAL(contractApplyInfo, contractApply);
                list.Add(contractApplyInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int           recordID = Convert.ToInt32(Request["RecordID"]);
        int           applyID  = Convert.ToInt32(Request["ApplyID"]);
        bool          rejected = Convert.ToBoolean(Request["rejected"]);
        Apply         ap       = Apply.GetApplyByID(applyID);
        ContractApply ci       = ContractApply.GetContractApplyByID(recordID);

        staffName.Text           = ci.StaffName;
        department.Text          = ci.Department_str;
        contractName.Text        = ci.ContractName;
        projectName.Text         = ci.ProjectName;
        projectCode.Text         = ci.ProjectCode;
        money.Text               = ci.Money.ToString();
        partyBAddress.Text       = ci.PartyBAddress;
        partyBContact.Text       = ci.PartyBContact;
        partyBName.Text          = ci.PartyBName;
        partyBTelephone.Text     = ci.PartyBTelephone;
        businessLicense.Checked  = ci.BusinessLicense;
        industoryLicense.Checked = ci.IndustoryLicense;
        processShow.Text         = ci.ApproveProcess;

        if (ci.Others != "")
        {
            others.Checked = true; otherInfo.Text = ci.Others;
        }



        //用户权限相关显示功能
        Users     usr  = (Users)Session["Identify"];
        BasicInfo info = BasicInfo.GetBasicInfoByID(usr.UserID);

        if (!rejected && ap.NextApprover == ci.StaffName)
        {
            agreeButton.Visible    = false;
            disagreeButton.Visible = false;
            whyDisagree.Visible    = false;
        }
        else if (info.StaffName.Trim() == ci.StaffName.Trim() || info.Position.Trim() == "出纳")
        {
            agreeButton.Visible    = false;
            disagreeButton.Visible = false;
            if (info.Position.Trim() != "出纳")
            {
                whyDisagree.Visible = false;
            }
        }
        //测试阶段保持处理流程可见,运行阶段记得去掉
        processShow.Visible = true;
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 插入或更新一条合同审批记录,根据编号
    /// </summary>
    /// <param name="id"></param>
    /// <param name="ci"></param>
    public static void SetContractApplyByID(int id, ContractApply ci, int userID)
    {
        SqlConnection conn = new SqlConnection(connString);
        SqlCommand    cmd;
        bool          isExist = HasContractApplyInfo(id);

        if (isExist)
        {
            cmd = new SqlCommand("UPDATE [ContractApplies] SET [StaffName] = @StaffName, [Department]=@Department,[ContractName]=@ContractName, [ProjectName]=@ProjectName, [ProjectCode]=@ProjectCode, [Money]=@Money, [PartyBName]=@PartyBName, [PartyBAddress]=@PartyBAddress, [PartyBContact] = @PartyBContact, [PartyBTelephone]=@PartyBTelephone, [BusinessLicense]=@BusinessLicense, [IndustoryLicense]=@IndustoryLicense, [Others]=@Others, [ApproveProcess]=@ApproveProcess WHERE [ApplyID] = @ApplyID", conn);
        }
        else
        {
            cmd = new SqlCommand("INSERT INTO [ContractApplies] ([StaffName], [Department], [ContractName],  [ProjectName], [ProjectCode], [Money], [PartyBName], [PartyBAddress], [PartyBContact], [PartyBTelephone], [BusinessLicense], [IndustoryLicense],[Others]) VALUES ( @StaffName, @Department, @ContractName,  @ProjectName, @ProjectCode, @Money, @PartyBName, @PartyBAddress, @PartyBContact, @PartyBTelephone, @BusinessLicense, @IndustoryLicense,@Others)  Select @@Identity as 'Identity'", conn);
        }
        cmd.Parameters.Add("@ApplyID", SqlDbType.Int).Value             = id;
        cmd.Parameters.Add("@StaffName", SqlDbType.VarChar).Value       = ci.staffName;
        cmd.Parameters.Add("@Department", SqlDbType.VarChar).Value      = ci.department;
        cmd.Parameters.Add("@ContractName", SqlDbType.VarChar).Value    = ci.contractName;
        cmd.Parameters.Add("@ProjectName", SqlDbType.VarChar).Value     = ci.projectName;
        cmd.Parameters.Add("@ProjectCode", SqlDbType.VarChar).Value     = ci.projectCode;
        cmd.Parameters.Add("@Money", SqlDbType.Float).Value             = ci.money;
        cmd.Parameters.Add("@PartyBName", SqlDbType.VarChar).Value      = ci.partyBName;
        cmd.Parameters.Add("@PartyBAddress", SqlDbType.VarChar).Value   = ci.partyBAddress;
        cmd.Parameters.Add("@PartyBContact", SqlDbType.VarChar).Value   = ci.partyBContact;
        cmd.Parameters.Add("@PartyBTelephone", SqlDbType.VarChar).Value = ci.partyBTelephone;
        cmd.Parameters.Add("@BusinessLicense", SqlDbType.Bit).Value     = ci.businessLicense;
        cmd.Parameters.Add("@IndustoryLicense", SqlDbType.Bit).Value    = ci.industoryLicense;
        cmd.Parameters.Add("@Others", SqlDbType.VarChar).Value          = ci.others;
        cmd.Parameters.Add("@ApproveProcess", SqlDbType.VarChar).Value  = ci.approveProcess;

        conn.Open();

        //同时在标准化申请表中插入一条记录
        int recordId = Convert.ToInt32(cmd.ExecuteScalar());

        if (!isExist)
        {
            SqlCommand cmd2 = new SqlCommand("INSERT INTO [AllApplies] ( [ApplyStaff], [ApplyDate], [ApplyType], [NextApprover], [RecordID], [Result]) VALUES (@ApplyStaff, @ApplyDate, @ApplyType, @NextApprover, @RecordID, @Result)", conn);
            cmd2.Parameters.Add("@ApplyStaff", SqlDbType.VarChar).Value = ci.staffName;
            cmd2.Parameters.Add("@ApplyDate", SqlDbType.DateTime).Value = DateTime.Now;
            cmd2.Parameters.Add("@ApplyType", SqlDbType.VarChar).Value  = "合同审批";
            cmd2.Parameters.Add("@RecordID", SqlDbType.Int).Value       = recordId;

            cmd2.Parameters.Add("@NextApprover", SqlDbType.VarChar).Value = getNextApprover(userID, ci.department);
            cmd2.Parameters.Add("@Result", SqlDbType.Bit).Value           = false;
            cmd2.ExecuteNonQuery();
        }


        conn.Close();
    }
Ejemplo n.º 6
0
    private void updateApprove(string if_agree, string next, BasicInfo info, bool if_back)
    {
        Users         usr      = (Users)Session["Identify"];
        int           recordID = Convert.ToInt32(Request["RecordID"]);
        ContractApply ci       = ContractApply.GetContractApplyByID(recordID);

        ci.ApproveProcess += info.StaffName.Trim() + "-" + if_agree + ",";
        ContractApply.SetContractApplyByID(recordID, ci, usr.UserID);

        string nextApprover = next;
        int    applyID      = Convert.ToInt32(Request["ApplyID"]);

        Apply.UpdateNextApprover(applyID, nextApprover, if_back);
    }
Ejemplo n.º 7
0
 /// <summary>
 /// 保存
 /// </summary>
 public override void Save()
 {
     if (!m_Loaded)           //新增
     {
         ContractApply contractApply = new ContractApply();
         SaveToDb(this, contractApply, true);
     }
     else            //修改
     {
         ContractApply contractApply = new ContractApply(contractApplyId);
         if (contractApply.IsNew)
         {
             throw new AppException("该数据已经不存在了");
         }
         SaveToDb(this, contractApply, false);
     }
 }
Ejemplo n.º 8
0
        //数据持久化
        internal static void  SaveToDb(ContractApplyInfo pContractApplyInfo, ContractApply pContractApply, bool pIsNew)
        {
            pContractApply.ContractApplyId = pContractApplyInfo.contractApplyId;
            pContractApply.ContractFileId  = pContractApplyInfo.contractFileId;
            pContractApply.SignName        = pContractApplyInfo.signName;
            pContractApply.ContractNum     = pContractApplyInfo.contractNum;
            pContractApply.SheetNum        = pContractApplyInfo.sheetNum;
            pContractApply.Today           = pContractApplyInfo.today;
            pContractApply.ContractName    = pContractApplyInfo.contractName;
            pContractApply.BeginDate       = pContractApplyInfo.beginDate;
            pContractApply.ApplyDate       = pContractApplyInfo.applyDate;
            pContractApply.ContractDes     = pContractApplyInfo.contractDes;
            pContractApply.BigMoney        = pContractApplyInfo.bigMoney;
            pContractApply.SmallMoney      = pContractApplyInfo.smallMoney;
            pContractApply.UseStampType    = pContractApplyInfo.useStampType;
            pContractApply.SectionView     = pContractApplyInfo.sectionView;
            pContractApply.ManagerView     = pContractApplyInfo.managerView;
            pContractApply.IsMoney         = pContractApplyInfo.isMoney;
            pContractApply.ApplyTime       = pContractApplyInfo.applyTime;
            pContractApply.ApplyName       = pContractApplyInfo.applyName;
            pContractApply.DepartName      = pContractApplyInfo.departName;
            pContractApply.State           = pContractApplyInfo.state;
            pContractApply.IsNew           = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pContractApply.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(ContractApplyInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pContractApplyInfo.contractApplyId = pContractApply.ContractApplyId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)))
            {
                ResetCache();
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <returns>是否成功</returns>
        public override void Delete()
        {
            if (!m_Loaded)
            {
                throw new AppException("尚未初始化");
            }
            bool result = (ContractApply.Delete(ContractApplyId) == 1);

            //更新缓存
            if (result && CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)))
            {
                ResetCache();
            }
            if (!result)
            {
                throw new AppException("删除失败,数据可能被删除");
            }
        }
Ejemplo n.º 10
0
 private void LoadFromId(int contractApplyId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)))
     {
         ContractApplyInfo contractApplyInfo = Find(GetList(), contractApplyId);
         if (contractApplyInfo == null)
         {
             throw new AppException("未能在缓存中找到相应的键值对象");
         }
         Copy(contractApplyInfo, this);
     }
     else
     {
         ContractApply contractApply = new ContractApply(contractApplyId);
         if (contractApply.IsNew)
         {
             throw new AppException("尚未初始化");
         }
         LoadFromDAL(this, contractApply);
     }
 }
Ejemplo n.º 11
0
 //从后台获取数据
 internal static void  LoadFromDAL(ContractApplyInfo pContractApplyInfo, ContractApply pContractApply)
 {
     pContractApplyInfo.contractApplyId = pContractApply.ContractApplyId;
     pContractApplyInfo.contractFileId  = pContractApply.ContractFileId;
     pContractApplyInfo.signName        = pContractApply.SignName;
     pContractApplyInfo.contractNum     = pContractApply.ContractNum;
     pContractApplyInfo.sheetNum        = pContractApply.SheetNum;
     pContractApplyInfo.today           = pContractApply.Today;
     pContractApplyInfo.contractName    = pContractApply.ContractName;
     pContractApplyInfo.beginDate       = pContractApply.BeginDate;
     pContractApplyInfo.applyDate       = pContractApply.ApplyDate;
     pContractApplyInfo.contractDes     = pContractApply.ContractDes;
     pContractApplyInfo.bigMoney        = pContractApply.BigMoney;
     pContractApplyInfo.smallMoney      = pContractApply.SmallMoney;
     pContractApplyInfo.useStampType    = pContractApply.UseStampType;
     pContractApplyInfo.sectionView     = pContractApply.SectionView;
     pContractApplyInfo.managerView     = pContractApply.ManagerView;
     pContractApplyInfo.isMoney         = pContractApply.IsMoney;
     pContractApplyInfo.applyTime       = pContractApply.ApplyTime;
     pContractApplyInfo.applyName       = pContractApply.ApplyName;
     pContractApplyInfo.departName      = pContractApply.DepartName;
     pContractApplyInfo.state           = pContractApply.State;
     pContractApplyInfo.Loaded          = true;
 }
Ejemplo n.º 12
0
        /// <summary>
        /// 付款申请保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tbApplySave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // 先将界面的数据保存到对象里
            ContractApply apply = new ContractApply() { ContractID = m_contract.ID,
                                                        ApplyDate = DateTime.Parse(dtApplyDate.EditValue.ToString()) };
            if (calcApplyMoney.EditValue != null)
                apply.Money = decimal.Parse(calcApplyMoney.EditValue.ToString());
            apply.Memo = txtApplyMemo.Text;

            // 判断是否通过校验
            if (!apply.InsertUpdateVerify())
            {
                dxErrorProvider1.ClearErrors();
                dxErrorProvider1.SetError(calcApplyMoney, apply.ErrorString);
                return;
            }
            else
            {
                apply.Save();
                tbApplySave.Enabled = false;
                layoutControl2.Enabled = false;
                m_status = winStatusEnum.查看;
                MessageBox.Show("合同付款申请保存成功!", "注意");
            }
        }
Ejemplo n.º 13
0
 //删除记录
 public static void DelContractApply(int cid)
 {
     ContractApply.Delete(cid);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 保存
 /// </summary>
 public override void Save()
 {
     if(!m_Loaded)//新增
     {
         ContractApply contractApply=new ContractApply();
         SaveToDb(this, contractApply,true);
     }
     else//修改
     {
         ContractApply contractApply=new ContractApply(contractApplyId);
         if(contractApply.IsNew)
             throw new AppException("该数据已经不存在了");
         SaveToDb(this, contractApply,false);
     }
 }
Ejemplo n.º 15
0
 //从后台获取数据
 internal static void LoadFromDAL(ContractApplyInfo pContractApplyInfo, ContractApply  pContractApply)
 {
     pContractApplyInfo.contractApplyId = pContractApply.ContractApplyId;
      		pContractApplyInfo.contractFileId = pContractApply.ContractFileId;
      		pContractApplyInfo.signName = pContractApply.SignName;
      		pContractApplyInfo.contractNum = pContractApply.ContractNum;
      		pContractApplyInfo.sheetNum = pContractApply.SheetNum;
      		pContractApplyInfo.today = pContractApply.Today;
      		pContractApplyInfo.contractName = pContractApply.ContractName;
      		pContractApplyInfo.beginDate = pContractApply.BeginDate;
      		pContractApplyInfo.applyDate = pContractApply.ApplyDate;
      		pContractApplyInfo.contractDes = pContractApply.ContractDes;
      		pContractApplyInfo.bigMoney = pContractApply.BigMoney;
      		pContractApplyInfo.smallMoney = pContractApply.SmallMoney;
      		pContractApplyInfo.useStampType = pContractApply.UseStampType;
      		pContractApplyInfo.sectionView = pContractApply.SectionView;
      		pContractApplyInfo.managerView = pContractApply.ManagerView;
      		pContractApplyInfo.isMoney = pContractApply.IsMoney;
      		pContractApplyInfo.applyTime = pContractApply.ApplyTime;
      		pContractApplyInfo.applyName = pContractApply.ApplyName;
      		pContractApplyInfo.departName = pContractApply.DepartName;
      		pContractApplyInfo.state = pContractApply.State;
     pContractApplyInfo.Loaded=true;
 }
Ejemplo n.º 16
0
 //数据持久化
 internal static void SaveToDb(ContractApplyInfo pContractApplyInfo, ContractApply  pContractApply,bool pIsNew)
 {
     pContractApply.ContractApplyId = pContractApplyInfo.contractApplyId;
      		pContractApply.ContractFileId = pContractApplyInfo.contractFileId;
      		pContractApply.SignName = pContractApplyInfo.signName;
      		pContractApply.ContractNum = pContractApplyInfo.contractNum;
      		pContractApply.SheetNum = pContractApplyInfo.sheetNum;
      		pContractApply.Today = pContractApplyInfo.today;
      		pContractApply.ContractName = pContractApplyInfo.contractName;
      		pContractApply.BeginDate = pContractApplyInfo.beginDate;
      		pContractApply.ApplyDate = pContractApplyInfo.applyDate;
      		pContractApply.ContractDes = pContractApplyInfo.contractDes;
      		pContractApply.BigMoney = pContractApplyInfo.bigMoney;
      		pContractApply.SmallMoney = pContractApplyInfo.smallMoney;
      		pContractApply.UseStampType = pContractApplyInfo.useStampType;
      		pContractApply.SectionView = pContractApplyInfo.sectionView;
      		pContractApply.ManagerView = pContractApplyInfo.managerView;
      		pContractApply.IsMoney = pContractApplyInfo.isMoney;
      		pContractApply.ApplyTime = pContractApplyInfo.applyTime;
      		pContractApply.ApplyName = pContractApplyInfo.applyName;
      		pContractApply.DepartName = pContractApplyInfo.departName;
      		pContractApply.State = pContractApplyInfo.state;
     pContractApply.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pContractApply.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(ContractApplyInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pContractApplyInfo.contractApplyId = pContractApply.ContractApplyId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)))
     {
         ResetCache();
     }
 }
Ejemplo n.º 17
0
 private void LoadFromId(int contractApplyId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)))
     {
         ContractApplyInfo contractApplyInfo=Find(GetList(), contractApplyId);
         if(contractApplyInfo==null)
             throw new AppException("未能在缓存中找到相应的键值对象");
         Copy(contractApplyInfo, this);
     }
     else
     {	ContractApply contractApply=new ContractApply( contractApplyId);
         if(contractApply.IsNew)
         throw new AppException("尚未初始化");
        	LoadFromDAL(this, contractApply);
     }
 }