public frmObjectSearch(string proj) : this() { mProj = new TB_PROJECT(); List <PTS_TABLE_SRC> srclist = new List <PTS_TABLE_SRC>(); PTS_TABLE_SRC tmp = new PTS_TABLE_SRC(); tmp.TABLE_NAME = "请选择"; tmp.TABLE_VALUE = "0"; tmp.ID = 0; PTS_TABLE_SRC[] arr = PTS_TABLE_SRCDAO.FindAll(new EqExpression("TABLE_ID", "PTS_TABLE_OBJECT_TYPE")); if (arr.Length > 0) { srclist = new List <PTS_TABLE_SRC>(arr); srclist.Insert(0, tmp); } this.cmbObjType.ItemsSource = null; this.cmbObjType.ItemsSource = srclist; this.cmbObjType.DisplayMemberPath = "TABLE_NAME"; this.cmbObjType.SelectedIndex = 0; this.txtObjName.Text = proj; TB_PROJECT[] _arr = TB_PROJECTDAO.FindAll(new LikeExpression("OBJECTNAME", "%" + this.txtObjName.Text + "%"), new EqExpression("STATUS", 1)); if (_arr.Length > 0) { mList = new List <TB_PROJECT>(_arr); } this.dgObject.ItemsSource = screening(mList); }
public frmObjectSearch(int type = 0) { InitializeComponent(); mType = type; mProj = new TB_PROJECT(); List <PTS_TABLE_SRC> srclist = new List <PTS_TABLE_SRC>(); PTS_TABLE_SRC tmp = new PTS_TABLE_SRC(); tmp.TABLE_NAME = "请选择"; tmp.TABLE_VALUE = "0"; tmp.ID = 0; PTS_TABLE_SRC[] arr = PTS_TABLE_SRCDAO.FindAll(new EqExpression("TABLE_ID", "PTS_TABLE_OBJECT_TYPE")); if (arr.Length > 0) { srclist = new List <PTS_TABLE_SRC>(arr); srclist.Insert(0, tmp); } this.cmbObjType.ItemsSource = null; this.cmbObjType.ItemsSource = srclist; this.cmbObjType.DisplayMemberPath = "TABLE_NAME"; this.cmbObjType.SelectedIndex = 0; TB_PROJECT[] _arr = null; //if(type==1) // _arr = TB_PROJECTDAO.FindAll(new LikeExpression("OBJECTNAME", "%" + this.txtObjName.Text + "%"), new EqExpression("STATUS", 1), new NotExpression(new EqExpression("BILLSTATUS", "已结算"))); //else _arr = TB_PROJECTDAO.FindAll(new LikeExpression("OBJECTNAME", "%" + this.txtObjName.Text + "%"), new EqExpression("STATUS", 1)); if (_arr.Length > 0) { mList = new List <TB_PROJECT>(_arr); for (int i = 0; i < mList.Count; i++) { if (!string.IsNullOrEmpty(mList[i].OBJECTTYPENAME)) { string identity = Comment.setProjIdentity(mList[i].OBJECTTYPENAME); mList[i].ProjIdentity = identity; } } if (type == 1) { mList = mList.FindAll(a => a.BILLSTATUS == "已结算"); } } this.dgObject.ItemsSource = screening(mList); }
private void brnSearch_Click(object sender, RoutedEventArgs e) { //OBJECTNAME OBJECTTYPE new LikeExpression("Cablenumber", "%" + cable + "%") string OBJECTNAME = this.txtObjName.Text; int objectTypeId = (this.cmbObjType.SelectionBoxItem as PTS_TABLE_SRC).ID; TB_PROJECT[] arr = null; DateTime start = dtpBeginDate.DateTime; DateTime end = dtpEndDate.DateTime; List <ICriterion> IClist = new List <ICriterion>(); IClist.Add(new EqExpression("STATUS", 1)); if (!string.IsNullOrEmpty(txtObjName.Text)) { IClist.Add(new LikeExpression("OBJECTNAME", "%" + txtObjName.Text + "%")); } if (chk.IsChecked == true) { IClist.Add(new AndExpression(new GeExpression("BEGINDATE", start), new LeExpression("ENDDATE", end))); } if (objectTypeId > 0) { IClist.Add(new EqExpression("OBJECTTYPE", objectTypeId)); } arr = TB_PROJECTDAO.FindAll(IClist.ToArray()); if (arr != null && arr.Length > 0) { mList = new List <TB_PROJECT>(arr); } if (mType == 1) { mList = mList.FindAll(a => a.BILLSTATUS == null); } this.dgObject.ItemsSource = null; if (arr != null) { mList = new List <TB_PROJECT>(arr); //根据角色过滤 this.dgObject.ItemsSource = null; this.dgObject.ItemsSource = screening(mList); } }
/// <summary> /// 线路工程查询 /// </summary> /// <param name="objectName">工程名称</param> /// <param name="leaderName">工程负责人</param> /// <param name="projectType">工程类型</param> /// <param name="start">工期开始时间</param> /// <param name="end">工期结束时间</param> /// <returns></returns> public static List <TB_PROJECT> QueryProject(string projName, string leader, string projectType, DateTime?start = null, DateTime?end = null) { List <TB_PROJECT> list = new List <TB_PROJECT>(); try { List <ICriterion> IClist = new List <ICriterion>(); IClist.Add(new EqExpression("STATUS", 1)); if (!string.IsNullOrEmpty(projName)) { IClist.Add(new LikeExpression("OBJECTNAME", "%" + projName + "%")); } if (!string.IsNullOrEmpty(leader)) { IClist.Add(new LikeExpression("TEAMLEDER", leader)); } if (!string.IsNullOrEmpty(projectType)) { IClist.Add(new LikeExpression("OBJECTTYPENAME", "%" + projectType + "%")); } if (start != null && end != null) { BetweenExpression betw1 = new BetweenExpression("BEGINDATE", start, end);//(new GeExpression("BEGINDATE", start), new LeExpression("ENDDATE", end)); //BetweenExpression betw2 = new BetweenExpression("ENDDATE", start, end); IClist.Add(betw1); } TB_PROJECT[] arr = TB_PROJECTDAO.FindAll(IClist.ToArray()); if (arr != null && arr.Length > 0) { list = new List <TB_PROJECT>(arr); } } catch (Exception ex) { MessageHelper.ShowMessage(ex.Message); } return(list); }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { try { //获取提成全局设置信息: decimal ratio1 = Global.g_ratio1; //Utils.NvDecimal(PTS_TABLE_SRCDAO.FindFirst(new EqExpression("TABLE_ID", "PTS_TABLE_RATIO"), new EqExpression("TABLE_NAME", "固定均分提成比例")).TABLE_VALUE); decimal ratio2 = Global.g_ratio2; //Utils.NvDecimal(PTS_TABLE_SRCDAO.FindFirst(new EqExpression("TABLE_ID", "PTS_TABLE_RATIO"), new EqExpression("TABLE_NAME", "可分配提成比率")).TABLE_VALUE); if (mProj == null) //新增工程信息 { //检查OBJECTNAME(工程名称)是否重复? if (!string.IsNullOrEmpty(txtOBJECTNAME.Text)) { TB_PROJECT[] existProj = TB_PROJECTDAO.FindAll(new EqExpression("STATUS", 1), new EqExpression("OBJECTNAME", this.txtOBJECTNAME.Text)); if (existProj.Length > 0) { MessageHelper.ShowMessage("项目名称有重复,请检查"); this.txtOBJECTNAME.Focus(); return; } } else { MessageHelper.ShowMessage("请填写项目名称"); return; } TB_PROJECT proj = new TB_PROJECT(); proj.OBJECTNAME = this.txtOBJECTNAME.Text; proj.CONTRACTNO = this.txtCONTRACTNO.Text; proj.COMPANYNAME = this.txtCOMPANYNAME.Text; proj.ADDRESS = this.txtADDRESS.Text; proj.BEGINDATE = this.dtpBeginDate.DateTime; proj.ENDDATE = this.dtpEndDate.DateTime; proj.OBJECTTYPENAME = getProjidentity(); proj.MONEY = decimal.Parse(this.txtMoney.Text); //折扣 //proj.ZHEKOU = decimal.Parse(txtZHKOU.Text); if (this.chkBillStatus.IsChecked == true) { proj.BILLSTATUS = "已结算"; proj.BILLDATE = TableManager.DBServerTime(); } //负责人 if (txtleder.Tag != null && (txtleder.Tag as TB_User).USER_NAME == txtleder.Text) { proj.TEAMLEDER = (txtleder.Tag as TB_User).USER_CODE.ToString(); proj.TEAMLEDERNAME = (txtleder.Tag as TB_User).USER_NAME; } //成员 proj.TEAMMEMBER = getTeamMember(); //发票 proj.MEMO = this.txtMemo.Text; proj.CREATEUSER = Global.g_usercode; //创建者 proj.RATIO1 = ratio1; proj.RATIO2 = ratio2; proj.Save(); #region 项目管理费 //根据工程金额保存管理费 TB_EXPENSE exp = new TB_EXPENSE(); exp.MONEY = RatioBusiness.QueryProjCost(decimal.Parse(this.txtMoney.Text)); exp.EXPENS = "管理费"; exp.EXPENSTYPE = 16; exp.OPUID = 0; exp.OBJECTID = TB_PROJECTDAO.FindFirst(new EqExpression("OBJECTNAME", proj.OBJECTNAME)).Id; exp.Save(); #endregion MessageHelper.ShowMessage("保存成功!"); } else //更新工程信息 { //判断是否已有报销信息,如果有报销信息项目不能再更新 TB_EXPENSE[] arr = TB_EXPENSEDAO.FindAll(new EqExpression("OBJECTID", mProj.Id), new EqExpression("STATUS", 1)); if (arr.Length > 0 && Global.g_userrole != 9) { MessageHelper.ShowMessage("该项目已有报销信息,不能再更新项目信息!"); return; } else if (arr.Length == 0 && Global.g_userrole != 9) { mProj.OBJECTNAME = this.txtOBJECTNAME.Text; mProj.CONTRACTNO = this.txtCONTRACTNO.Text; mProj.COMPANYNAME = this.txtCOMPANYNAME.Text; mProj.ADDRESS = this.txtADDRESS.Text; mProj.BEGINDATE = this.dtpBeginDate.DateTime; mProj.ENDDATE = this.dtpEndDate.DateTime; mProj.OBJECTTYPENAME = getProjidentity(); mProj.MONEY = decimal.Parse(this.txtMoney.Text); //折扣 //mProj.ZHEKOU = decimal.Parse(txtZHKOU.Text); if (this.chkBillStatus.IsChecked == true) { mProj.BILLSTATUS = "已结算"; mProj.BILLDATE = TableManager.DBServerTime(); } else { mProj.BILLSTATUS = ""; } //负责人 if (txtleder.Tag != null && (txtleder.Tag as TB_User).USER_NAME == txtleder.Text) { mProj.TEAMLEDER = (txtleder.Tag as TB_User).USER_CODE.ToString(); mProj.TEAMLEDERNAME = (txtleder.Tag as TB_User).USER_NAME; } //成员 mProj.TEAMMEMBER = getTeamMember(); //发票 mProj.MEMO = this.txtMemo.Text; mProj.RATIO1 = ratio1; mProj.RATIO2 = ratio2; mProj.Update(); } MessageHelper.ShowMessage("保存成功!"); } #region 发票信息处理 //先把工程对应的所有发票全部作废,再重新新增 TB_PROJECT temp = TB_PROJECTDAO.FindFirst(new EqExpression("OBJECTNAME", txtOBJECTNAME.Text)); BaseBusiness bb = new BaseBusiness(); bool rtn = bb.DelALLItem("TB_BILL", "PROJECTID=" + temp.Id + ""); List <TB_BILL> ls = getBills(); if (ls.Count > 0) { if (rtn == true) { for (int i = 0; i < ls.Count; i++) { TB_BILL bill = new TB_BILL(); bill.CREATEDATE = ls[i].CREATEDATE; bill.BILLNUMBER = ls[i].BILLNUMBER; bill.PROJECTID = temp.Id; bill.MONEY = ls[i].MONEY; bill.STATUS = 1; bill.Save(); } } else { MessageHelper.ShowMessage("保存发票信息发生错误!"); } } #endregion } catch (Exception ex) { MessageHelper.ShowMessage(ex.Message); } }