using System; using System.IO; using System.Linq; using System.Web.Mvc; using System.Collections.Generic; using HcUtility.Comm; using HcUtility.Core; using DSWeb.EntityDA; using DSWeb.Models; using DSWeb.Attributes; using DSWeb.SoftMng.DAL.MsInfoClientFeedbackDAL; using DSWeb.SoftMng.Models.MsInfoClientFeedback; using DSWeb.MvcShipping.Helper; using DSWeb.MvcShipping.Comm.Cookie; using DSWeb.MvcShipping.DAL.MsBaseInfoDAL; namespace DSWeb.SoftMng.Controllers { [JsonRequestBehavior] public class MsInfoClientFeedbackController : Controller { public ActionResult Index() { return View(); } public ActionResult Edit() { return View(); } #region 主列表查询 public ContentResult GetDataList(int start, int limit, string sort, string condition) { var dataList = MsInfoClientFeedbackDAL.GetDataList(condition, Convert.ToString(Session["USERID"]).ToString().Trim(), Convert.ToString(Session["SHOWNAME"]).ToString().Trim(), Convert.ToString(Session["COMPANYID"]).ToString().Trim(), sort); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetData(string condition) { VW_Feedback_InfoEntity head = null; head = MsInfoClientFeedbackDAL.GetData(condition, Convert.ToString(Session["USERID"]).ToString().Trim(), Convert.ToString(Session["SHOWNAME"]).ToString().Trim(), Convert.ToString(Session["COMPANYID"]).ToString().Trim()); var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = head }); return new ContentResult() { Content = json }; } #endregion #region 删除 public ContentResult Delete(string data) { if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") { var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; } // var head = JsonConvert.Deserialize(data); var modb = new ModelObjectDB(); //DBResult result = modb.Delete(head); DBResult result = MsInfoClientFeedbackDAL.Delete(head); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } #endregion #region 主列表保存 public ContentResult Save(string data) { if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") { var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; } // T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); var headData = JsonConvert.Deserialize(data); MsInfoClientFeedbackEntity hdFeedback = new MsInfoClientFeedbackEntity(); MsInfoClientFeedbackInfoEntity hdFeedbackInfo = new MsInfoClientFeedbackInfoEntity(); MsInfoClientFeedbackInfoEntity hdFeedbackInfo_HF = new MsInfoClientFeedbackInfoEntity(); var isPost = true; var errorstr = ""; // #region 主表 hdFeedback.FEEDBACKID = headData.FEEDBACKID == null ? "" : headData.FEEDBACKID.ToString().Trim();//FEEDBACKID // string sSQL = "select top 1 isnull(classKey,0) as classKey from InfoClass where className='" + headData.FEEDBACKTYPE.ToString() + "' and parentID='CI20161222000001'"; string sFEEDBACKTYPE = T_ALL_DA.GetStrSQL("classKey", sSQL); int iFEEDBACKTYPE = 4;//日常维护 if (sFEEDBACKTYPE.Trim() != "") { iFEEDBACKTYPE = int.Parse(sFEEDBACKTYPE); } hdFeedback.FEEDBACKTYPE = iFEEDBACKTYPE;//反馈类型 //hdFeedback.FEEDBACKTYPE = int.Parse(headData.FEEDBACKTYPE.ToString());//反馈类型 // sSQL = "select top 1 isnull(classKey,0) as classKey from InfoClass where className='" + headData.STATUS.ToString() + "' and parentID='CI20161220000007'"; string sSTATUS = T_ALL_DA.GetStrSQL("classKey", sSQL); int iSTATUS = 2;//已受理未完成 if (sSTATUS.Trim() != "") { iSTATUS = int.Parse(sSTATUS); } hdFeedback.STATUS = iSTATUS;//维护状态 //hdFeedback.STATUS = int.Parse(headData.STATUS.ToString());//STATUS // sSQL = "select top 1 GID from info_client where SHORTNAME='" + headData.COMPANYID.ToString() + "'"; string sCOMPANYID = T_ALL_DA.GetStrSQL("GID", sSQL); hdFeedback.COMPANYID = sCOMPANYID;//客户加载_委托单位 //hdFeedback.COMPANYID = headData.COMPANYID == null ? "" : headData.COMPANYID.ToString().Trim();//COMPANYID // hdFeedback.DEPARTMENT = "";//DEPARTMENT hdFeedback.MASTER = headData.MASTER == null ? "" : headData.MASTER.ToString().Trim();//MASTER hdFeedback.TELEPHONE = "";//TELEPHONE hdFeedback.EMAIL = "";//EMAIL hdFeedback.QQ = "";//QQ hdFeedback.BEGINDATE = DateTime.Parse(headData.BEGINDATE.ToString("yyyy-MM-dd"));//BEGINDATE //hdFeedback.ENDDATE hdFeedback.PRIORITY = "";//PRIORITY // sSQL = "select top 1 classKey from InfoClass where className='" + headData.ACTION.ToString() + "' and parentID='CI20170122000001'"; string sACTION = T_ALL_DA.GetStrSQL("classKey", sSQL); hdFeedback.ACTION = sACTION;//客户维护方式 //hdFeedback.ACTION = headData.ACTION == null ? "" : headData.ACTION.ToString().Trim();//ACTION // hdFeedback.EXPENSE = Decimal.Parse(headData.EXPENSE.ToString("F2"));//EXPENSE // sSQL = "select top 1 GID from info_client_item where ITEMNAME='" + headData.PROJECT.ToString() + "' and LINKGID='" + sCOMPANYID + "'"; string sPROJECT = T_ALL_DA.GetStrSQL("GID", sSQL); hdFeedback.PROJECT = sPROJECT; //hdFeedback.PROJECT = headData.PROJECT == null ? "" : headData.PROJECT.ToString().Trim();//PROJECT // //hdFeedback.COMPLETEDATE hdFeedback.SATISFACTION = ""; hdFeedback.ACCEPTANCESUGGESTION = ""; hdFeedback.ACCEPTANCEMASTER = ""; //hdFeedback.ACCEPTANCEDATE hdFeedback.ISTOP = false; hdFeedback.CREATER = Convert.ToString(Session["SHOWNAME"]).ToString().Trim(); hdFeedback.CREATEDATE = DateTime.Now; hdFeedback.MODIFYUSER = Convert.ToString(Session["SHOWNAME"]).ToString().Trim(); hdFeedback.MODIFYDATE = DateTime.Now; hdFeedback.ISSEND = false;//ISSEND hdFeedback.ISDELETE = false;//ISDELETE // sSQL = "select top 1 isnull(classKey,0) as classKey from InfoClass where className='" + headData.USERTYPE.ToString() + "' and parentID='CI20170123000001'"; string sUSERTYPE = T_ALL_DA.GetStrSQL("classKey", sSQL); int iUSERTYPE = 0;//客服 if (sUSERTYPE.Trim() != "") { iUSERTYPE = int.Parse(sUSERTYPE); } hdFeedback.USERTYPE = iUSERTYPE;//录入人类型 //hdFeedback.USERTYPE = int.Parse(headData.USERTYPE.ToString().Trim());//录入人类型 // if (hdFeedback.FEEDBACKID == "*" || hdFeedback.FEEDBACKID.ToString().Trim() == "") { hdFeedback.FEEDBACKID = "EI" + DateTime.Now.ToString("yyyyMMddHmsfff");//惟一编号 varchar(36) hdFeedback.DbOperationType = DbOperationType.DbotIns; } else { hdFeedback.DbOperationType = DbOperationType.DbotUpd; hdFeedback.ModelUIStatus = "E"; } #endregion #region 明细表_问 hdFeedbackInfo.FEEDBACKID = hdFeedback.FEEDBACKID == null ? "" : hdFeedback.FEEDBACKID.ToString().Trim();//FEEDBACKID hdFeedbackInfo.REMARKID = headData.REMARKID == null ? "" : headData.REMARKID.ToString().Trim();//REMARKID hdFeedbackInfo.REMARKTYPE = false;//问 hdFeedbackInfo.REMARK = headData.REMARK == null ? "" : headData.REMARK.ToString().Trim();//REMARK hdFeedbackInfo.CREATER = Convert.ToString(Session["SHOWNAME"]).ToString().Trim();//CREATER hdFeedbackInfo.CREATEDATE = DateTime.Now;//CREATEDATE hdFeedbackInfo.MODIFYUSER = Convert.ToString(Session["SHOWNAME"]).ToString().Trim();//MODIFYUSER hdFeedbackInfo.MODIFYDATE = DateTime.Now;//MODIFYDATE if (hdFeedbackInfo.REMARKID == "*" || hdFeedbackInfo.REMARKID.ToString().Trim()=="") { hdFeedbackInfo.REMARKID = "IR" + DateTime.Now.ToString("yyyyMMddHmsfff");//惟一编号 varchar(36) hdFeedbackInfo.DbOperationType = DbOperationType.DbotIns; } else { hdFeedbackInfo.DbOperationType = DbOperationType.DbotUpd; hdFeedbackInfo.ModelUIStatus = "E"; } #endregion #region 明细表_回复 hdFeedbackInfo_HF.FEEDBACKID = hdFeedback.FEEDBACKID == null ? "" : hdFeedback.FEEDBACKID.ToString().Trim();//FEEDBACKID hdFeedbackInfo_HF.REMARKID = headData.REMARKID_HF == null ? "" : headData.REMARKID_HF.ToString().Trim();//REMARKID hdFeedbackInfo_HF.REMARKTYPE = true;//答 hdFeedbackInfo_HF.REMARK = headData.REMARK_HF == null ? "" : headData.REMARK_HF.ToString().Trim();//REMARK hdFeedbackInfo_HF.CREATER = Convert.ToString(Session["SHOWNAME"]).ToString().Trim();//CREATER hdFeedbackInfo_HF.CREATEDATE = DateTime.Now;//CREATEDATE hdFeedbackInfo_HF.MODIFYUSER = Convert.ToString(Session["SHOWNAME"]).ToString().Trim();//MODIFYUSER hdFeedbackInfo_HF.MODIFYDATE = DateTime.Now;//MODIFYDATE if (hdFeedbackInfo_HF.REMARKID == "*" || hdFeedbackInfo_HF.REMARKID.ToString().Trim() == "") { hdFeedbackInfo_HF.REMARKID = "IR" + DateTime.Now.ToString("yyyyMMddHmsfff");//惟一编号 varchar(36) hdFeedbackInfo_HF.DbOperationType = DbOperationType.DbotIns; } else { hdFeedbackInfo_HF.DbOperationType = DbOperationType.DbotUpd; hdFeedbackInfo_HF.ModelUIStatus = "E"; } #endregion if (isPost) { var modb = new ModelObjectDB(); DBResult result = modb.Save(hdFeedback); if (result.Success && hdFeedbackInfo.REMARK.ToString().Trim() != "") { hdFeedbackInfo.REMARK = hdFeedbackInfo.REMARK.Replace("\r\n", "
"); DBResult result2 = modb.Save(hdFeedbackInfo); } if (result.Success && hdFeedbackInfo_HF.REMARK.ToString().Trim()!="") { hdFeedbackInfo_HF.REMARK = hdFeedbackInfo_HF.REMARK.Replace("\r\n", "
"); DBResult result2 = modb.Save(hdFeedbackInfo_HF); } //DBResult result = MsInfoClientFeedbackDAL.Save(headData); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = MsInfoClientFeedbackDAL.GetData("FEEDBACKID='" + hdFeedback.FEEDBACKID + "'", Convert.ToString(Session["USERID"]).ToString().Trim(), Convert.ToString(Session["SHOWNAME"]).ToString().Trim(), Convert.ToString(Session["COMPANYID"]).ToString().Trim()) }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } else { var jsonRespose = new JsonResponse { Success = false, Message =errorstr }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } } #endregion #region 取得客户的维护类型(年、次结) public ContentResult GetSTLNAME(string LINKGID) { string sSTLNAME = MsInfoClientFeedbackDAL.GetSTLNAME(LINKGID); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = sSTLNAME }); return new ContentResult() { Content = json }; } #endregion #region 明细表查询 public ContentResult GetFeedbackInfoList(int start, int limit, string sort, string condition) { var dataList = MsInfoClientFeedbackDAL.GetFeedbackInfoList(condition, Convert.ToString(Session["USERID"]).ToString().Trim(), Convert.ToString(Session["SHOWNAME"]).ToString().Trim(), Convert.ToString(Session["COMPANYID"]).ToString().Trim(), sort); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } #endregion #region 保存明细列表 public ContentResult SaveFeedbackInfo(string dataHead, string data) { if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") { var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; } // T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); var headData = JsonConvert.Deserialize(dataHead); var headData2 = JsonConvert.Deserialize(data); MsInfoClientFeedbackEntity hdFeedback = new MsInfoClientFeedbackEntity(); MsInfoClientFeedbackInfoEntity hdFeedbackInfo = new MsInfoClientFeedbackInfoEntity(); var isPost = true; var errorstr = ""; // #region 主表 string sSQL = "select top 1 classKey from InfoClass where className='" + headData.ACTION.ToString() + "' and parentID='CI20170122000001'"; string sACTION = T_ALL_DA.GetStrSQL("classKey", sSQL); Decimal dEXPENSE = Decimal.Parse(headData.EXPENSE.ToString("F2")); sSQL = "update Feedback set ACTION=" + sACTION + ",EXPENSE=" + dEXPENSE + ",MODIFYUSER='" + Convert.ToString(Session["SHOWNAME"]).ToString().Trim() + "',MODIFYDATE=getdate() where FEEDBACKID='" + headData.FEEDBACKID.ToString().Trim() + "'"; bool bl = T_ALL_DA.GetExecuteSqlCommand(sSQL); #endregion #region 明细表 hdFeedbackInfo.FEEDBACKID = headData.FEEDBACKID == null ? "" : headData.FEEDBACKID.ToString().Trim();//FEEDBACKID hdFeedbackInfo.REMARKID = headData2.REMARKID == null ? "" : headData2.REMARKID.ToString().Trim();//REMARKID bool blREMARKTYPE = headData2.REMARKTYPENAME.ToString().Trim() == "问" ? false : true; hdFeedbackInfo.REMARKTYPE = blREMARKTYPE;//问 hdFeedbackInfo.REMARK = headData2.REMARK == null ? "" : headData2.REMARK.ToString().Trim().Replace("
", "\r\n");//REMARK hdFeedbackInfo.CREATER = Convert.ToString(Session["SHOWNAME"]).ToString().Trim();//CREATER hdFeedbackInfo.CREATEDATE = DateTime.Now;//CREATEDATE hdFeedbackInfo.MODIFYUSER = Convert.ToString(Session["SHOWNAME"]).ToString().Trim();//MODIFYUSER hdFeedbackInfo.MODIFYDATE = DateTime.Now;//MODIFYDATE if (hdFeedbackInfo.REMARKID == "*" || hdFeedbackInfo.REMARKID.ToString().Trim() == "") { hdFeedbackInfo.REMARKID = "IR" + DateTime.Now.ToString("yyyyMMddHmsfff");//惟一编号 varchar(36) hdFeedbackInfo.DbOperationType = DbOperationType.DbotIns; } else { hdFeedbackInfo.DbOperationType = DbOperationType.DbotUpd; hdFeedbackInfo.ModelUIStatus = "E"; } #endregion if (isPost) { var modb = new ModelObjectDB(); DBResult result = modb.Save(hdFeedbackInfo); //DBResult result = MsInfoClientFeedbackDAL.Save(headData); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = MsInfoClientFeedbackDAL.GetDataFeedbackInfo("FEEDBACKID='" + hdFeedbackInfo.FEEDBACKID + "' and REMARKID='" + hdFeedbackInfo.REMARKID.ToString() + "'") }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } else { var jsonRespose = new JsonResponse { Success = false, Message = errorstr }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } } #endregion #region 删除明细列表 public ContentResult DeleteFeedbackInfo(string data) { if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") { var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; } // var head = JsonConvert.Deserialize(data); var modb = new ModelObjectDB(); //DBResult result = modb.Delete(head); DBResult result = MsInfoClientFeedbackDAL.DeleteFeedbackInfo(head); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } #endregion #region 提交 public ContentResult onEnter(string data) { if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") { var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; } // var head = JsonConvert.Deserialize(data); var modb = new ModelObjectDB(); DBResult result = MsInfoClientFeedbackDAL.onEnter(head); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } #endregion // } }