123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649 |
- using LeaRun.Application.IService.InstallManage;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- //using LeaRun.Application.Busines.InstallManage;
- using LeaRun.Application.Entity.InstallManage;
- using LeaRun.Data;
- using LeaRun.Util.WebControl;
- using System.Data;
- using LeaRun.Application.Code;
- using LeaRun.Util;
- using System.Reflection;
- namespace LeaRun.Application.Service.InstallManage
- {
- public class InstallManageService : IInstallManageService
- {
- SqlHelper sqlHelper = new SqlHelper("InstallDB");
- public String GetInstallApplyData(String st, String et, InstallApplyEntity mt, Pagination pagination)
- {
- String sql = "";
- DataTable dt;
- StringBuilder sb = new StringBuilder();
- String json = "";
- Char c = ',';
- String SurveyType = "", DesginType = "", DesginVerfiyType = "", MasterVerifyType = "", budgetType = "", PayMentType = "", ConstructionType = "", AcceptType = "", ThroughWaterType = "", CreateCusInfoType = "";
- int total = pagination.records;
- sb.Append("SELECT [Apply_ID] ,[Apply_Number],[Dis_ID] ,[CustomerName],[LinkMan],[LinkManMobile],[CustomerAddr],[ApplyHouseHold_Num],[Metercaliber]");
- sb.Append(",[ApplyTime],[Operater],[SurveyType],[SurveyTime],[SurveyOperater],[SurveySugget],[DesginType],[DesginTime],[DesginOperater],[DesginImage],[DesginVerfiy]");
- sb.Append(",[DesginSugget],[DesginVerfiyName],[DesginVerfiyTime],[DesginVerfiyType],[MasterVerifyType],[MasterVerfiySugget],[MasterVerfiyOperater],[MasterVerfiyTime]");
- sb.Append(",[budgetType],[budgetOperater],[PayMentOperater],[PayMentType],[ConstructionOperater],[ConstructionType],[AcceptOperater],[AcceptType],[ThroughWaterOperater]");
- sb.Append(",[ThroughWaterType],[CreateCusInfoType],[CreateCusInfoOperater],[budgetTime],[PayMentTime],[ConstructionTime],[AcceptTime],[ThroughWaterTime],[CreateCusInfoTime] FROM INS_Apply WHERE 1=1 ");
- if (st != null)
- {
- if (et != null)
- {
- sb.Append(" AND ApplyTime BETWEEN '").Append(st).Append("' AND '").Append(et).Append(" 23:59:59' ");
- }
- }
- if (mt == null)
- {
- sql = sb.ToString();
- }
- else
- {
- if (mt.SurveyType != null) // 勘测
- {
- sb.Append(" AND SurveyType = ").Append(mt.SurveyType);
- }
- if (mt.DesginType != null) //设计
- {
- sb.Append(" AND DesginType = ").Append(mt.DesginType);
- }
- if (mt.DesginVerfiyType != null) // 设计审核
- {
- sb.Append(" AND DesginVerfiyType = ").Append(mt.DesginVerfiyType);
- }
- if (mt.MasterVerifyType != null)//经理审核
- {
- sb.Append(" AND MasterVerifyType = ").Append(mt.MasterVerifyType);
- }
- if (mt.budgetType != null)//预算
- {
- sb.Append(" AND budgetType = ").Append(mt.budgetType);
- }
- if (mt.PayMentType != null)//缴费
- {
- sb.Append(" AND PayMentType = ").Append(mt.PayMentType);
- }
- if (mt.ConstructionType != null)//施工
- {
- sb.Append(" AND ConstructionType = ").Append(mt.ConstructionType);
- }
- if (mt.AcceptType != null)//验收
- {
- sb.Append(" AND AcceptType = ").Append(mt.AcceptType);
- }
- if (mt.ThroughWaterType != null)//通水
- {
- sb.Append(" AND ThroughWaterType = ").Append(mt.ThroughWaterType);
- }
- if (mt.CreateCusInfoType != null)//立户
- {
- sb.Append(" AND CreateCusInfoType = ").Append(mt.CreateCusInfoType);
- }
- sql = sb.ToString();
- }
- dt = sqlHelper.ExecuteDataTable(sql, "", false, pagination.rows, pagination.page, out total, null);
- pagination.records = total;
- if (dt.Rows.Count > 0)
- {
- //pagination.records = dt.Rows.Count;
- //int startNum = pagination.rows * (pagination.page - 1);
- //int endNum = pagination.rows * pagination.page;
- //if (startNum > pagination.records)
- //{
- // startNum = 0;
- // endNum = dt.Rows.Count;
- //}
- //if (endNum > pagination.records)
- //{
- // endNum = dt.Rows.Count;
- //}
- sb.Clear();
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- DataRow r = dt.Rows[i];
- #region 判断各种情况
- switch (r["SurveyType"].ToString())//勘测
- {
- case "0":
- SurveyType = "未勘测";
- break;
- case "1":
- SurveyType = "已勘测";
- break;
- case "2":
- SurveyType = "未通过";
- break;
- }
- switch (r["DesginType"].ToString())//设计
- {
- case "0":
- DesginType = "未设计";
- break;
- case "1":
- DesginType = "已设计";
- break;
- case "2":
- DesginType = "未通过";
- break;
- }
- switch (r["DesginVerfiyType"].ToString())//设计审核
- {
- case "0":
- DesginVerfiyType = "未审核";
- break;
- case "1":
- DesginVerfiyType = "已通过";
- break;
- case "2":
- DesginVerfiyType = "未通过";
- break;
- }
- switch (r["MasterVerifyType"].ToString())//经理审核
- {
- case "0":
- MasterVerifyType = "未审核";
- break;
- case "1":
- MasterVerifyType = "已通过";
- break;
- case "2":
- MasterVerifyType = "驳回";
- break;
- }
- switch (r["budgetType"].ToString())//预算审核
- {
- case "0":
- budgetType = "未预算";
- break;
- case "1":
- budgetType = "已预算";
- break;
- case "2":
- budgetType = "";
- break;
- }
- switch (r["PayMentType"].ToString())//缴费审核
- {
- case "0":
- PayMentType = "未缴费";
- break;
- case "1":
- PayMentType = "已缴费";
- break;
- case "2":
- PayMentType = "";
- break;
- }
- switch (r["ConstructionType"].ToString())//设计审核
- {
- case "0":
- ConstructionType = "未施工";
- break;
- case "1":
- ConstructionType = "施工中";
- break;
- case "2":
- ConstructionType = "已完成";
- break;
- }
- switch (r["AcceptType"].ToString())//设计审核
- {
- case "0":
- AcceptType = "未验收";
- break;
- case "1":
- AcceptType = "已验收";
- break;
- case "2":
- AcceptType = "";
- break;
- }
- switch (r["ThroughWaterType"].ToString())//设计审核
- {
- case "0":
- ThroughWaterType = "未通水";
- break;
- case "1":
- ThroughWaterType = "已通水";
- break;
- case "2":
- ThroughWaterType = "";
- break;
- }
- switch (r["CreateCusInfoType"].ToString())//设计审核
- {
- case "0":
- CreateCusInfoType = "未立户";
- break;
- case "1":
- CreateCusInfoType = "已立户";
- break;
- case "2":
- CreateCusInfoType = "";
- break;
- }
- #endregion
- #region 拼接sql
- sb.Append("{");
- sb.Append("\"Apply_ID\":\"").Append(r["Apply_ID"].ToString()).Append("\",");
- sb.Append("\"Apply_Number\":\"").Append(r["Apply_Number"].ToString()).Append("\",");
- sb.Append("\"Dis_ID\":\"").Append(r["Dis_ID"] != System.DBNull.Value ? r["Dis_ID"].ToString() : "").Append("\",");
- sb.Append("\"CustomerName\":\"").Append(r["CustomerName"].ToString()).Append("\",");
- sb.Append("\"LinkMan\":\"").Append(r["LinkMan"].ToString()).Append("\",");
- sb.Append("\"LinkManMobile\":\"").Append(r["LinkManMobile"].ToString()).Append("\",");
- sb.Append("\"CustomerAddr\":\"").Append(r["CustomerAddr"].ToString()).Append("\",");
- sb.Append("\"ApplyHouseHold_Num\":\"").Append(r["ApplyHouseHold_Num"].ToString()).Append("\",");
- sb.Append("\"Metercaliber\":\"").Append(r["Metercaliber"] != System.DBNull.Value ? r["Metercaliber"].ToString() : "").Append("\",");
- sb.Append("\"ApplyTime\":\"").Append(r["ApplyTime"] != System.DBNull.Value ? Convert.ToDateTime(r["ApplyTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"Operater\":\"").Append(r["Operater"].ToString()).Append("\",");
- sb.Append("\"SurveyType\":\"").Append(SurveyType).Append("\",");
- sb.Append("\"SurveyTime\":\"").Append(r["SurveyTime"] != System.DBNull.Value ? Convert.ToDateTime(r["SurveyTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"SurveyOperater\":\"").Append(r["SurveyOperater"].ToString()).Append("\",");
- sb.Append("\"SurveySugget\":\"").Append(r["SurveySugget"].ToString()).Append("\",");
- sb.Append("\"DesginType\":\"").Append(DesginType).Append("\",");
- sb.Append("\"DesginTime\":\"").Append(r["DesginTime"] != System.DBNull.Value ? Convert.ToDateTime(r["DesginTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"DesginOperater\":\"").Append(r["DesginOperater"].ToString()).Append("\",");
- sb.Append("\"DesginImage\":\"").Append(r["DesginImage"].ToString()).Append("\",");
- //sb.Append("\"DesginVerfiy\":\"").Append(r[19]).Append("\",");
- sb.Append("\"DesginSugget\":\"").Append(r["DesginSugget"].ToString()).Append("\",");
- sb.Append("\"DesginVerfiyName\":\"").Append(r["DesginVerfiyName"].ToString()).Append("\",");
- sb.Append("\"DesginVerfiyTime\":\"").Append(r["DesginVerfiyTime"] != System.DBNull.Value ? Convert.ToDateTime(r["DesginVerfiyTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"DesginVerfiyType\":\"").Append(DesginVerfiyType).Append("\",");
- sb.Append("\"MasterVerifyType\":\"").Append(MasterVerifyType).Append("\",");
- sb.Append("\"MasterVerfiySugget\":\"").Append(r["MasterVerfiySugget"].ToString()).Append("\",");
- sb.Append("\"MasterVerfiyOperater\":\"").Append(r["MasterVerfiyOperater"].ToString()).Append("\",");
- sb.Append("\"MasterVerfiyTime\":\"").Append(r["MasterVerfiyTime"] != System.DBNull.Value ? Convert.ToDateTime(r["MasterVerfiyTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"budgetType\":\"").Append(budgetType).Append("\",");
- sb.Append("\"budgetOperater\":\"").Append(r["budgetOperater"].ToString()).Append("\",");
- sb.Append("\"PayMentOperater\":\"").Append(r["PayMentOperater"].ToString()).Append("\",");
- sb.Append("\"PayMentType\":\"").Append(PayMentType).Append("\",");
- sb.Append("\"ConstructionOperater\":\"").Append(r["ConstructionOperater"].ToString()).Append("\",");
- sb.Append("\"ConstructionType\":\"").Append(ConstructionType).Append("\",");
- sb.Append("\"AcceptOperater\":\"").Append(r["AcceptOperater"].ToString()).Append("\",");
- sb.Append("\"AcceptType\":\"").Append(AcceptType).Append("\",");
- sb.Append("\"ThroughWaterOperater\":\"").Append(r["ThroughWaterOperater"].ToString()).Append("\",");
- sb.Append("\"ThroughWaterType\":\"").Append(ThroughWaterType).Append("\",");
- sb.Append("\"CreateCusInfoType\":\"").Append(CreateCusInfoType).Append("\",");
- sb.Append("\"CreateCusInfoOperater\":\"").Append(r["CreateCusInfoOperater"].ToString()).Append("\",");
- sb.Append("\"budgetTime\":\"").Append(r["budgetTime"] != System.DBNull.Value ? Convert.ToDateTime(r["budgetTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"PayMentTime\":\"").Append(r["PayMentTime"] != System.DBNull.Value ? Convert.ToDateTime(r["PayMentTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"ConstructionTime\":\"").Append(r["ConstructionTime"] != System.DBNull.Value ? Convert.ToDateTime(r["ConstructionTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"AcceptTime\":\"").Append(r["AcceptTime"] != System.DBNull.Value ? Convert.ToDateTime(r["AcceptTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"ThroughWaterTime\":\"").Append(r["ThroughWaterTime"] != System.DBNull.Value ? Convert.ToDateTime(r["ThroughWaterTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"CreateCusInfoTime\":\"").Append(r["CreateCusInfoTime"] != System.DBNull.Value ? Convert.ToDateTime(r["CreateCusInfoTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\"");
- sb.Append("},");
- #endregion
- json = "[" + sb.ToString().TrimEnd(c) + "]";
- }
- }
- return json;
- }
- // 保存 申请
- public void SaveApply(String applyNumber, String cusName, String linkMan, String linkMobile, String cusAdrr, String applyNum)
- {
- //定义变量
- StringBuilder sb = new StringBuilder();
- String sql = "";
- String curTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- String curOperator = "";
- //赋值
- curOperator = OperatorProvider.Provider.Current().UserName;
- //编写 insert sql
- sb.Append("INSERT INTO INS_Apply (Apply_Number,CustomerName,LinkMan,LinkManMobile,CustomerAddr,ApplyHouseHold_Num,ApplyTime,Operater) values ('");
- sb.Append(applyNumber).Append("','").Append(cusName).Append("','").Append(linkMan).Append("','").Append(linkMobile).Append("','");
- sb.Append(cusAdrr).Append("',").Append(applyNum).Append(",'").Append(curTime).Append("','").Append(curOperator).Append("'");
- sb.Append(")");
- sqlHelper.ExecuteNoParams(sb.ToString(), CommandType.Text);
- }
- // 勘测
- public void SaveSurvey(String surveySuggset, Int32 apply_id)
- {
- String op = OperatorProvider.Provider.Current().UserName;
- String sql = "Update INS_Apply SET SurveyType = 1 ,SurveySugget = '" + surveySuggset + "',SurveyTime = GETDATE(),SurveyOperater = '" + op + "' WHERE Apply_ID = " + apply_id.ToString();
- sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- }
- //申请的form
- public InstallApplyEntity GetFormJson(String keyValue)
- {
- InstallApplyEntity entity = new InstallApplyEntity();
- String sql = "SELECT * FROM INS_Apply WHERE Apply_ID = " + keyValue;
- DataTable dt = sqlHelper.ExecuteDataTable(sql, CommandType.Text, null);
- List<InstallApplyEntity> list = DataHelper.DataTableToT<InstallApplyEntity>(dt);
- if (list.Count > 0)
- {
- entity = list[0];
- }
- return entity;
- }
- public String GetInstallDudgetData(String applyId, InstallDudgetEntity mt, Pagination pagination)
- {
- //定义变量
- String json = "";
- DataTable dt;
- Int32 total = 0;
- StringBuilder sb = new StringBuilder();
- Char c = ',';
- // 客户地址 型号 类型 费用类型 单位 数量 单价 费用 人工费 审核 审核人 发票表号 开票人 开票时间 打印情况
- String sql = "SELECT name,Dudget_ID,Apply_ID,Depot_ID,[Version],[Type],MoneyType,unit,number,price,Creater,CreateDt,PaymentMoney,LabourCost,VerifyType,VerfiyName,InvoiceCode,PaymentName,PaymentTime,PrintType FROM INS_Budget WHERE Apply_ID = " + applyId;
- try
- {
- dt = sqlHelper.ExecuteDataTable(sql, "", false, pagination.rows, pagination.page, out total, null);
- pagination.records = total;
- if (dt.Rows.Count > 0)
- {
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- DataRow r = dt.Rows[i];
- sb.Append("{");
- sb.Append("\"Apply_ID\":\"").Append(r["Apply_ID"].ToString()).Append("\",");
- sb.Append("\"Dudget_ID\":\"").Append(r["Dudget_ID"] != System.DBNull.Value ? r["Dudget_ID"].ToString() : "").Append("\",");
- sb.Append("\"Depot_ID\":\"").Append(r["Depot_ID"] != System.DBNull.Value ? r["Depot_ID"].ToString() : "").Append("\",");
- sb.Append("\"Version\":\"").Append(r["Version"].ToString()).Append("\",");
- sb.Append("\"Type\":\"").Append(r["Type"].ToString()).Append("\",");
- sb.Append("\"MoneyType\":\"").Append(r["MoneyType"] != System.DBNull.Value ? r["MoneyType"].ToString() : "").Append("\",");
- sb.Append("\"unit\":\"").Append(r["unit"] != System.DBNull.Value ? r["unit"].ToString() : "").Append("\",");
- sb.Append("\"number\":\"").Append(r["number"] != System.DBNull.Value ? r["number"].ToString() : "").Append("\",");
- sb.Append("\"price\":\"").Append(r["price"] != System.DBNull.Value ? r["price"].ToString() : "").Append("\",");
- sb.Append("\"Creater\":\"").Append(r["Creater"] != System.DBNull.Value ? r["Creater"].ToString() : "").Append("\",");
- sb.Append("\"CreateDt\":\"").Append(r["CreateDt"] != System.DBNull.Value ? Convert.ToDateTime(r["CreateDt"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"PaymentMoney\":\"").Append(r["PaymentMoney"] != System.DBNull.Value ? r["PaymentMoney"].ToString() : "").Append("\",");
- sb.Append("\"LabourCost\":\"").Append(r["LabourCost"] != System.DBNull.Value ? r["LabourCost"].ToString() : "").Append("\",");
- sb.Append("\"VerifyType\":\"").Append(r["VerifyType"] != System.DBNull.Value ? r["VerifyType"].ToString() : "").Append("\",");
- sb.Append("\"VerfiyName\":\"").Append(r["VerfiyName"] != System.DBNull.Value ? r["VerfiyName"].ToString() : "").Append("\",");
- sb.Append("\"InvoiceCode\":\"").Append(r["InvoiceCode"] != System.DBNull.Value ? r["InvoiceCode"].ToString() : "").Append("\",");
- sb.Append("\"PaymentName\":\"").Append(r["PaymentName"] != System.DBNull.Value ? r["PaymentName"].ToString() : "").Append("\",");
- sb.Append("\"PaymentTime\":\"").Append(r["PaymentTime"] != System.DBNull.Value ? Convert.ToDateTime(r["PaymentTime"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\",");
- sb.Append("\"PrintType\":\"").Append(r["PrintType"] != System.DBNull.Value ? r["PrintType"].ToString() : "").Append("\",");
- sb.Append("\"name\":\"").Append(r["name"] != System.DBNull.Value ? r["name"].ToString() : "").Append("\"");
- sb.Append("},");
- }
- json = "[" + sb.ToString().TrimEnd(c) + "]";
- }
- }
- catch (Exception ex)
- {
- json = ex.Message;
- }
- return json;
- }
- /// <summary>
- /// 获得预算细节
- /// </summary>
- /// <returns></returns>
- ///
- public DataSet GetBudgetDetail()
- {
- DataSet ds = new DataSet();
- string sqlType = "select materialId, Name from dbo.WM_materialtype";
- string sqlGoods = "select GoodId,Name,Specifications,Materialid from dbo.WM_Goods";
- string sqlUnit = "select UnitId, CalculateUnit from dbo.WM_CalculateUnit";
- DataTable dtType = sqlHelper.ExecuteDataTable(sqlType, CommandType.Text, null);
- DataTable dtGoods = sqlHelper.ExecuteDataTable(sqlGoods,CommandType.Text,null);
- DataTable dtUnit = sqlHelper.ExecuteDataTable(sqlUnit,CommandType.Text,null);
- ds.Tables.Add(dtType);
- ds.Tables.Add(dtGoods);
- ds.Tables.Add(dtUnit);
- return ds;
- }
- public DataTable GetBudgetDetailGoods(string materialID)
- {
- string sqlGoods = "select GoodId,Name,Specifications,Materialid from dbo.WM_Goods where Materialid=" + materialID ;
- DataTable dtGoods = sqlHelper.ExecuteDataTable(sqlGoods, CommandType.Text, null);
- return dtGoods;
- }
- public String GetBudgetDetail110()
- {
- //定义变量
- string json = "";
- String json1 = "";
- string json2 = "";
- string json3 = "";
- DataTable dt1;
- DataTable dt2;
- DataTable dt3;
- StringBuilder sb1 = new StringBuilder();
- StringBuilder sb2 = new StringBuilder();
- StringBuilder sb3= new StringBuilder();
- Char c = ',';
- string sql1 = "select materialId, Name from dbo.WM_materialtype";
- string sql2 = "select GoodId,Name,Specifications from dbo.WM_Goods";
- string sql3 = "select UnitId, CalculateUnit from dbo.WM_CalculateUnit";
- try
- {
- dt1 = sqlHelper.ExecuteDataTable(sql1, CommandType.Text, null);
- if (dt1.Rows.Count > 0)
- {
- for (int i = 0; i < dt1.Rows.Count; i++)
- {
- DataRow r = dt1.Rows[i];
- sb1.Append("{");
- sb1.Append("\"materialId\":\"").Append(r["materialId"].ToString()).Append("\",");
- sb1.Append("\"Name\":\"").Append(r["Name"].ToString()).Append("\"");
- sb1.Append("},");
- }
- json1 = "[" + sb1.ToString().TrimEnd(c) + "]";
- }
- dt2 = sqlHelper.ExecuteDataTable(sql2, CommandType.Text, null);
- if (dt2.Rows.Count > 0)
- {
- for (int i = 0; i < dt2.Rows.Count; i++)
- {
- DataRow r = dt2.Rows[i];
- sb2.Append("{");
- sb2.Append("\"GoodId\":\"").Append(r["GoodId"].ToString()).Append("\",");
- sb2.Append("\"Name\":\"").Append(r["Name"].ToString()).Append("\",");
- sb2.Append("\"Specifications\":\"").Append(r["Specifications"].ToString()).Append("\"");
- sb2.Append("},");
- }
- json2 = "[" + sb2.ToString().TrimEnd(c) + "]";
- }
- dt3 = sqlHelper.ExecuteDataTable(sql3, CommandType.Text, null);
- if (dt3.Rows.Count > 0)
- {
- for (int i = 0; i < dt3.Rows.Count; i++)
- {
- DataRow r = dt3.Rows[i];
- sb3.Append("{");
- sb3.Append("\"UnitId\":\"").Append(r["UnitId"].ToString()).Append("\",");
- sb3.Append("\"CalculateUnit\":\"").Append(r["CalculateUnit"].ToString()).Append("\"");
- sb3.Append("},");
- }
- json3 = "[" + sb3.ToString().TrimEnd(c) + "]";
- }
- //json = json1 + "*" + json2 + "*" + json3;
- json = json1;
- }
- catch (Exception ex)
- {
- json = ex.Message;
- }
- return json;
- }
- public void SaveBudgetForma(String applyId, InstallDudgetEntity entity)
- {
- StringBuilder sb = new StringBuilder();
- String curOperator = OperatorProvider.Provider.Current().UserName;
- sb.Append("INSERT INTO INS_Budget(Apply_ID,[Version],[Type],unit,number,price,PaymentMoney,LabourCost,name,Creater,CreateDt) VALUES (");
- sb.Append(applyId).Append(",'").Append(entity.Version).Append("','").Append(entity.Type).Append("','");
- sb.Append(entity.unit).Append("',").Append(entity.number).Append(",").Append(entity.price).Append(",");
- sb.Append(entity.price * entity.number).Append(",").Append(entity.LabourCost).Append(",'").Append(entity.name).Append("','");
- sb.Append(curOperator).Append("',GETDATE()");
- sb.Append(")");
- try
- {
- sqlHelper.ExecuteNoParams(sb.ToString(), CommandType.Text);
- }
- catch (Exception ex)
- {
- }
- }
- public void SaveBudgetForm(String applyId)
- {
- String op = OperatorProvider.Provider.Current().UserName;
- String sql = "Update INS_Apply SET budgetType = 1,budgetTime = GETDATE(),budgetOperater = '" + op + "' WHERE Apply_ID = " + applyId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- try
- {
- sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- }
- catch (Exception ex)
- {
- }
- }
- //经理审核
- public void MasterVerify(String applyId)
- {
- String op = OperatorProvider.Provider.Current().UserName;
- String sql = "Update INS_Apply SET MasterVerifyType = 1,MasterVerfiyTime = GETDATE(),MasterVerfiyOperater = '" + op + "' WHERE Apply_ID = " + applyId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- try
- {
- sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- }
- catch (Exception ex)
- {
- }
- }
- //缴费
- public void PaymentForm(String applyId)
- {
- String op = OperatorProvider.Provider.Current().UserName;
- String sql = "Update INS_Apply SET PayMentType = 1,PayMentTime = GETDATE(),PayMentOperater = '" + op + "' WHERE Apply_ID = " + applyId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- try
- {
- sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- sql = "update INS_Budget SET PaymentName = '" + op + "' ,PaymentTime = GETDATE() where Apply_ID =" + applyId;
- sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- //施工
- public void UpdateEngineer(String appId, String type)
- {
- String op = OperatorProvider.Provider.Current().UserName;
- String sql = "Update INS_Apply SET ConstructionType = " + type + ",PayMentTime = GETDATE(),ConstructionOperater = '" + op + "' WHERE Apply_ID = " + appId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- try
- {
- sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- //sql = "update INS_Budget SET PaymentName = '" + op + "' ,PaymentTime = GETDATE() where Apply_ID =" + applyId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- //验收
- public void UpdateAceept(String appId, String type)
- {
- String op = OperatorProvider.Provider.Current().UserName;
- String sql = "Update INS_Apply SET AcceptType = " + type + ",AcceptTime = GETDATE(),AcceptOperater = '" + op + "' WHERE Apply_ID = " + appId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- try
- {
- sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- //sql = "update INS_Budget SET PaymentName = '" + op + "' ,PaymentTime = GETDATE() where Apply_ID =" + applyId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- //通水
- public void UpdateThroughWater(String appId, String type)
- {
- String op = OperatorProvider.Provider.Current().UserName;
- String sql = "Update INS_Apply SET ThroughWaterType = " + type + ",ThroughWaterTime = GETDATE(),ThroughWaterOperater = '" + op + "' WHERE Apply_ID = " + appId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- try
- {
- sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- //sql = "update INS_Budget SET PaymentName = '" + op + "' ,PaymentTime = GETDATE() where Apply_ID =" + applyId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- //导入
- public void UpdateCreateCus(String appId, String type)
- {
- String op = OperatorProvider.Provider.Current().UserName;
- String sql = "Update INS_Apply SET CreateCusInfoType = " + type + ",CreateCusInfoTime = GETDATE(),CreateCusInfoOperater = '" + op + "' WHERE Apply_ID = " + appId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- try
- {
- sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- //sql = "update INS_Budget SET PaymentName = '" + op + "' ,PaymentTime = GETDATE() where Apply_ID =" + applyId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- }
- }
|