public List<DesignRequestQuery> GetList(DesignRequestQuery query, out int totalCount) { try { return _DesignRequestDao.GetList(query, out totalCount); } catch (Exception ex) { throw new Exception("DesignRequestMgr.GetList-->" + ex.Message, ex); } }
public HttpResponseBase GetDesignRequestList() { string json = string.Empty; int totalCount = 0; DesignRequestQuery query = new DesignRequestQuery(); List<DesignRequestQuery> store = new List<DesignRequestQuery>(); _DesignRequestMgr = new DesignRequestMgr(mySqlConnectionString); try { query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "20");//用於分頁的變量 if (!string.IsNullOrEmpty(Request.Params["dr_requester"])) { query.dr_requester_id_name = Request.Params["dr_requester"].ToString().Trim(); } if (!string.IsNullOrEmpty(Request.Params["dr_type"])) { query.dr_type = Convert.ToInt32(Request.Params["dr_type"]); } if (!string.IsNullOrEmpty(Request.Params["assign_to"])) { query.dr_assign_to = Convert.ToInt32(Request.Params["assign_to"]); } if (!string.IsNullOrEmpty(Request.Params["status"])) { query.dr_status = Convert.ToInt32(Request.Params["status"]); } if (!string.IsNullOrEmpty(Request.Params["start_time"])) { query.start_time = Convert.ToDateTime(Request.Params["start_time"]).ToString("yyyy-MM-dd HH:mm:ss"); } if (!string.IsNullOrEmpty(Request.Params["search_date"])) { query.date_type = Convert.ToInt32(Request.Params["search_date"]); } if (!string.IsNullOrEmpty(Request.Params["end_time"])) { query.end_time = Convert.ToDateTime(Request.Params["end_time"]).ToString("yyyy-MM-dd HH:mm:ss"); } query.login_id = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; store = _DesignRequestMgr.GetList(query,out totalCount); foreach (var item in store) { if (item.dr_expected < DateTime.Now.Date) { item.Isgq = 1; } } IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}"; } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase TakeJob() { string json = string.Empty; DesignRequestQuery query = new DesignRequestQuery(); _DesignRequestMgr = new DesignRequestMgr(mySqlConnectionString); try { if (!string.IsNullOrEmpty(Request.Params["dr_id"])) { query.dr_ids = Request.Params["dr_id"].ToString(); } query.dr_ids = query.dr_ids.Substring(0, query.dr_ids.Length - 1); query.login_id = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; query.dr_assign_to = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; query.Istake = 1;//認領工作是全部設計人員都可認領 json = _DesignRequestMgr.UpdStatus(query); } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase DesigneeSave() { string json = string.Empty; DesignRequestQuery query = new DesignRequestQuery(); _DesignRequestMgr = new DesignRequestMgr(mySqlConnectionString); try { //獲取id if (!string.IsNullOrEmpty(Request.Params["dr_id"])) { query.dr_id = Convert.ToUInt32(Request.Params["dr_id"]); } //獲取狀態 if (!string.IsNullOrEmpty(Request.Params["dr_status"])) { query.dr_status = Convert.ToInt32(Request.Params["dr_status"]) + 1; } //獲取派工人員 if (!string.IsNullOrEmpty(Request.Params["dr_assign_to"])) { query.dr_assign_to = Convert.ToInt32(Request.Params["dr_assign_to"]); } query.login_id = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; json = _DesignRequestMgr.UpdStatus(query); } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public int DelDesignRequest(DesignRequestQuery query) { StringBuilder sb = new StringBuilder(); try { sb.AppendFormat(@"DELETE FROM design_request WHERE dr_id IN ({0});",query.dr_ids); return _accessMySql.execCommand(sb.ToString()); } catch (Exception ex) { throw new Exception("DesignRequestDao.DelDesignRequest-->" + ex.Message + sb.ToString(), ex); } }
public string DesignRequestEdit(DesignRequestQuery query) { string json = string.Empty; query.Replace4MySQL(); query.dr_resource_path = query.dr_resource_path.Replace("\\", "\\\\"); query.dr_document_path = query.dr_document_path.Replace("\\", "\\\\"); List<DisableKeywords> list = new List<DisableKeywords>(); try { int j = 0; list = _DesignRequestDao.GetKeyWordsList(); for (int i = 0; i < list.Count; i++) { if (query.dr_content_text.Contains(list[i].dk_string)) { j = 1; } } if (query.dr_id == 0) {//新增 if (query.product_id != 0 && query.dr_type == 4 && j != 1) { _DesignRequestDao.UpdateProductDetailText(query); } if (j == 1) { query.dr_status = 1; MailHelper mail = new MailHelper(); string sbHtml = "你好,派工系統申請的文案包含有禁用的關鍵字,還請前去查看新建立的項目 "; mail.SendToGroup("job", "派工系統", sbHtml.ToString(), false, true); } else { query.dr_status = 2;//已審核 if (GetExpected(query) > 0 && j != 1) {//已審核的文件直接算出期望完成時間 int day = Getday(query); //query.dr_expected = DateTime.Now.AddDays(day); query.day = day; } } int res = _DesignRequestDao.InsertDesignRequest(query); if (res > 0) { json = "{success:true,type:1,msg:1}";//type=1表示新增,msg=1表示新增成功 } else { json = "{success:true,type:1,msg:0}";//type=1表示新增,msg=0表示新增失敗 } } else { //編輯 query.dr_status = 1; DesignRequestQuery OldModel = new DesignRequestQuery(); OldModel = _DesignRequestDao.GetSingleDesignRequest(query); if (!string.IsNullOrEmpty(query.dr_type_tostring)) { query.dr_type = OldModel.dr_type; } if (query.product_id != 0 && query.dr_type == 4 && j != 1) { _DesignRequestDao.UpdateProductDetailText(query); } if (j == 1) { query.dr_status = 1; MailHelper mail = new MailHelper(); string sbHtml = "你好,派工系統申請的文案包含有禁用的關鍵字,還請前去查看新建立的項目 "; mail.SendToGroup("job", "派工系統", sbHtml.ToString(), false, true); } else { query.dr_status = 2; if (GetExpected(query) > 0 && j != 1) {//已審核的文件直接算出期望完成時間 int day = Getday(query); //query.dr_expected = DateTime.Now.AddDays(day); query.day = day; } } int res = _DesignRequestDao.UpdateDesignRequest(query); if (res > 0) { json = "{success:true,type:2,msg:1}";//type=2表示編輯,msg=1表示編輯成功 } else { json = "{success:true,type:2,msg:0}";//type=2表示編輯,msg=0表示編輯失敗 } } return json; } catch (Exception ex) { throw new Exception("DesignRequestMgr.DesignRequestEdit-->" + ex.Message, ex); } }
public bool IsManagerNumber(DesignRequestQuery drt) { try { return _DesignRequestDao.IsManagerNumber(drt); } catch (Exception ex) { throw new Exception("DesignRequestMgr.IsManagerNumber-->" + ex.Message, ex); } }
public bool IsManagerNumber(DesignRequestQuery drt) { bool bo=false; StringBuilder sb = new StringBuilder(); try { sb.Append(@"SELECT m.user_id from t_fgroup tf LEFT JOIN t_groupcaller tg ON tf.rowid=tg.groupId LEFT JOIN manage_user m ON tg.callid=m.user_email LEFT JOIN t_parametersrc t ON t.parameterCode=tf.rowid WHERE t.parameterType='design';"); DataTable _dt = _accessMySql.getDataTable(sb.ToString()); for (int i = 0; i < _dt.Rows.Count; i++) { if (Convert.ToInt32(_dt.Rows[i][0]) == drt.login_id) { bo= true; } } return bo; } catch (Exception ex) { throw new Exception("DesignRequestDao.IsManager-->" + ex.Message + sb.ToString(), ex); } }
public DataTable GetExpected(DesignRequestQuery drt) { DataTable _dt = new DataTable(); StringBuilder sb = new StringBuilder(); try { if (drt.dr_type > 0) { sb.AppendFormat("SELECT remark FROM t_parametersrc WHERE parameterType='job_day' and parameterCode='{0}' ", drt.dr_type); _dt = _accessMySql.getDataTable(sb.ToString()); } return _dt; } catch (Exception ex) { throw new Exception("DesignRequestDao.GetExpected-->" + ex.Message + sb.ToString(), ex); } }
public int UpdStatus(DesignRequestQuery drt) { StringBuilder sb = new StringBuilder(); try { if (drt.dr_status > 1) { sb.AppendFormat(@"update design_request set dr_status='{0}' ", drt.dr_status); if (drt.dr_assign_to > 0) { sb.AppendFormat(" ,dr_assign_to='{0}' ", drt.dr_assign_to); } if (drt.day > 0) { sb.AppendFormat(" ,dr_expected=DATE_ADD(NOW(),INTERVAL '{0}' DAY) ", drt.day); } if (drt.dr_id > 0) { sb.AppendFormat(" where dr_id in ({0}) ", drt.dr_id); } else { sb.AppendFormat(" where dr_id in ({0}) ", drt.dr_ids); } return _accessMySql.execCommand(sb.ToString()); } else { return 0; } } catch (Exception ex) { throw new Exception("DesignRequestDao.UpdStatus-->" + ex.Message + sb.ToString(), ex); } }
public bool IsManager(DesignRequestQuery drt) { StringBuilder sb = new StringBuilder(); try { sb.Append("SELECT parameterCode FROM t_parametersrc WHERE parameterType='design_manager';"); DataTable _dt = _accessMySql.getDataTable(sb.ToString()); if (_dt.Rows.Count > 0 && Convert.ToInt32(_dt.Rows[0][0]) == drt.login_id) { return true; } else { return false; } } catch (Exception ex) { throw new Exception("DesignRequestDao.IsManager-->" + ex.Message + sb.ToString(), ex); } }
public int UpdateProductDetailText(DesignRequestQuery drt) { StringBuilder sb = new StringBuilder(); try { DataTable _dt = GetPorductNameByProductId(Convert.ToInt32(drt.product_id)); sb.AppendFormat(@"update product set product_detail_text='{0}'", drt.dr_content_text); if (string.IsNullOrEmpty(_dt.Rows[0]["product_detail_text"].ToString())) {//無內容的變更時間和建立人 sb.AppendFormat(",detail_createdate='{0}',detail_created='{1}' ", Common.CommonFunction.DateTimeToString(DateTime.Now), drt.dr_requester_id); } else { sb.AppendFormat(",detail_updatedate='{0}',detail_update='{1}' ", Common.CommonFunction.DateTimeToString(DateTime.Now), drt.dr_requester_id); } sb.AppendFormat(" where product_id='{0}';", drt.product_id); return _accessMySql.execCommand(sb.ToString()); } catch (Exception ex) { throw new Exception("DesignRequestDao.UpdateProductDetailText-->" + ex.Message + sb.ToString(), ex); } }
public List<DesignRequestQuery> GetList(DesignRequestQuery query,out int totalCount) { StringBuilder sb = new StringBuilder(); StringBuilder sbwhere = new StringBuilder(); StringBuilder sbcount = new StringBuilder(); totalCount = 0; try { sb.Append("SELECT dr.dr_id,dr_type,dr.dr_content_text,dr.dr_description,dr.dr_document_path,dr.dr_resource_path"); sb.Append(",mu.user_username AS dr_requester_id_name,mu1.user_username AS dr_assign_to_name,tp1.parameterName as dr_type_tostring,tp3.parameterName AS dr_status_tostring,dr.dr_created,dr.dr_modified,dr.product_id,p.product_name,dr.dr_status,dr_expected,dr_assign_to "); sbwhere.Append(" FROM design_request dr "); sbwhere.Append(" LEFT JOIN manage_user mu ON mu.user_id=dr.dr_requester_id "); sbwhere.Append(" LEFT JOIN manage_user mu1 ON mu1.user_id=dr.dr_assign_to "); sbwhere.Append(" LEFT JOIN product p ON p.product_id=dr.product_id "); sbwhere.Append(" LEFT JOIN (SELECT tp.parameterName,tp.parameterCode FROM t_parametersrc tp WHERE tp.parameterType='job_type') tp1 ON tp1.parameterCode=dr.dr_type "); sbwhere.Append(" LEFT JOIN (SELECT tp2.parameterName,tp2.parameterCode FROM t_parametersrc tp2 WHERE tp2.parameterType='job_status') tp3 ON tp3.parameterCode=dr.dr_status "); sbcount.Append(" select count(dr.dr_id) as totalCount "); sbwhere.Append(" where 1=1 "); if (!IsManager(query) && !IsEmail(query) && !IsManagerNumber(query)) {//不是主管,不是郵件群組人員,不是設計部人員就限制查看的項目 sbwhere.AppendFormat(" and (dr.dr_requester_id='{0}' or dr.dr_assign_to ='{0}') ", query.login_id); } if (!string.IsNullOrEmpty(query.dr_requester_id_name)) { sbwhere.AppendFormat(" AND mu.user_username LIKE '%{0}%' ", query.dr_requester_id_name); } if (query.dr_type!=0) { sbwhere.AppendFormat(" and dr.dr_type='{0}' ", query.dr_type); } if (query.dr_assign_to != 0) { sbwhere.AppendFormat(" and dr.dr_assign_to='{0}' ", query.dr_assign_to); } if (query.dr_status != 0) { sbwhere.AppendFormat(" and dr.dr_status='{0}' ", query.dr_status); } else {//如果沒有選擇狀態默認為非已結案的全部顯示 sbwhere.AppendFormat(" and dr.dr_status<>'6' ", query.dr_status); } if (query.date_type != 0) { if (!string.IsNullOrEmpty(query.start_time)) { sbwhere.AppendFormat(" and dr.dr_created>='{0}' ", query.start_time); } if (!string.IsNullOrEmpty(query.end_time)) { sbwhere.AppendFormat(" and dr.dr_created<='{0}' ", query.end_time); } } if (query.IsPage) { sbcount.Append(sbwhere.ToString()); DataTable dt = _accessMySql.getDataTable(sbcount.ToString()); if (dt != null && dt.Rows.Count > 0) { totalCount = Convert.ToInt32(dt.Rows[0]["totalCount"]); } } sbwhere.AppendFormat(" order by dr.dr_id desc limit {0},{1} ",query.Start,query.Limit); sb.Append(sbwhere.ToString()); return _accessMySql.getDataTableForObj<DesignRequestQuery>(sb.ToString()); } catch (Exception ex) { throw new Exception("DesignRequestDao.GetList-->" + ex.Message + sb.ToString()+sbwhere.ToString(), ex); } }
public DesignRequestQuery GetSingleDesignRequest(DesignRequestQuery query) { StringBuilder sb = new StringBuilder(); try { sb.AppendFormat(@"SELECT dr_type,dr_assign_to FROM design_request WHERE dr_id='{0}'", query.dr_id); return _accessMySql.getSinggleObj<DesignRequestQuery>(sb.ToString()); } catch (Exception ex) { throw new Exception("DesignRequestDao.GetSingleDesignRequest-->" + ex.Message + sb.ToString(), ex); } }
public string DelDesignRequest(DesignRequestQuery query) { string json = ""; try { if (IsSelf(query)) { if (query.dr_status>2) { MailHelper mail = new MailHelper(); string sbHtml = "你好,派工系統分配給您的工作被需求者刪除,還請查看 "; if (!mail.SendToUser(GetmailId(query.dr_assign_to), "派工系統", sbHtml.ToString()))//發送email給指派的人員 { return json = "{success:true,msg:3}";//郵件發送失敗 } } if (_DesignRequestDao.DelDesignRequest(query) > 0) { return json = "{success:true,msg:0}"; } else { return json = "{success:true,msg:1}";//msg=1刪除失敗 } } else { return json = "{success:true,msg:2}";//msg=2不是需求者不能刪除 } } catch (Exception ex) { throw new Exception("DesignRequestMgr.DelDesignRequest-->" + ex.Message, ex); } }
//是否是檢查關鍵人人員 public bool IsEmail(DesignRequestQuery drt) { StringBuilder sb = new StringBuilder(); try { sb.Append(@"SELECT user_id from manage_user where user_email IN (SELECT user_mail from mail_user where row_id IN (SELECT user_id from mail_group_map where group_id IN (SELECT row_id from mail_group WHERE group_code='Job')));"); DataTable _dt = _accessMySql.getDataTable(sb.ToString()); for (int i = 0; i < _dt.Rows.Count; i++) { if (Convert.ToInt32(_dt.Rows[i][0]) == drt.login_id) { return true; } } return false; } catch (Exception ex) { throw new Exception("DesignRequestDao.IsEmail-->" + ex.Message + sb.ToString(), ex); } }
public string UpdStatus(DesignRequestQuery drt) { string json = string.Empty; try { if (drt.dr_status == 2 ) {//狀態為新建立,類型為內頁文, if (drt.product_id != 0&& drt.dr_type == 4) {//審核文字通過新增到product表,變更狀態 if (_DesignRequestDao.UpdateProductDetailText(drt) ==0) { return json = "{success:true,msg:3}";//更新內頁文失敗 } } if (GetExpected(drt) > 0) {//已審核的文件算出期望完成時間 int day = Getday(drt); drt.day = day; } if (_DesignRequestDao.UpdStatus(drt) > 0) { return json = "{success:true,msg:0}";//審核成功 } else { return json = "{success:false}"; } } else if (drt.dr_assign_to > 0) {//指派工作 變更指派人員 //認領工作只能設計部人員認領 //指派工作只能主管指派 if (_DesignRequestDao.IsManager(drt) ||(drt.Istake==1 && IsManagerNumber(drt))) { drt.dr_status = 3; MailHelper mail = new MailHelper(); string sbHtml = "你好,派工系統申請的文案通過審核分配給您,請前去查看工作內容 "; if (mail.SendToUser(GetmailId(drt.dr_assign_to), "派工系統", sbHtml.ToString()))//發送email給指派的人員 { if (_DesignRequestDao.UpdStatus(drt) > 0) { return json = "{success:true,msg:0}";//msg=2表示有敏感詞 } else { return json = "{success:false}";//msg=2表示有敏感詞 } } else { return json = "{success:true,msg:4}";//email發送失敗 } } else { return json = "{success:true,msg:2}";//msg=2不是設計部人員不能指派 } } else {//如果是設計人員就可以變更已指派後面的所有狀態 if (IsDesSelf(drt)) { if (_DesignRequestDao.UpdStatus(drt) > 0) { return json = "{success:true,msg:0}";//msg=2表示有敏感詞 } else { return json = "{success:false}";//msg=2表示有敏感詞 } } else { return json = "{success:true,msg:2}";//msg=2不是設計部人員不能指派 } } } catch (Exception ex) { throw new Exception("DesignRequestMgr.UpdStatus-->" + ex.Message, ex); } }
public bool IsDesSelf(DesignRequestQuery drt) { bool bo = false; StringBuilder sb = new StringBuilder(); try {//是否是自己申請的派工系統 sb.AppendFormat("SELECT dr_assign_to from design_request WHERE dr_id in ('{0}') ;", drt.dr_id); DataTable _dt = _accessMySql.getDataTable(sb.ToString()); for (int i = 0; i < _dt.Rows.Count; i++) { if (Convert.ToInt32(_dt.Rows[i][0]) == drt.login_id) { bo = true; } else { return false; } } return bo; } catch (Exception ex) { throw new Exception("DesignRequestDao.IsDesSelf-->" + ex.Message + sb.ToString(), ex); } }
public int GetExpected(DesignRequestQuery drt) { string json = string.Empty; int day =0; try { if (_DesignRequestDao.GetExpected(drt).Rows.Count>0) { if (int.TryParse(_DesignRequestDao.GetExpected(drt).Rows[0][0].ToString(),out day)) { return day; } } return day; } catch (Exception ex) { throw new Exception("DesignRequestMgr.GetExpected-->" + ex.Message, ex); } }
public int InsertDesignRequest(DesignRequestQuery query) { StringBuilder sb = new StringBuilder(); query.Replace4MySQL(); try { sb.AppendFormat(@"INSERT INTO design_request (dr_requester_id,dr_type,dr_assign_to,dr_content_text,dr_description,dr_resource_path,dr_document_path,dr_status,dr_created,product_id,dr_expected) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}',NOW(),'{8}',DATE_ADD(NOW(),INTERVAL '{9}' DAY));", query.dr_requester_id, query.dr_type, query.dr_assign_to, query.dr_content_text, query.dr_description, query.dr_resource_path, query.dr_document_path, query.dr_status, query.product_id, query.day); return _accessMySql.execCommand(sb.ToString()); } catch (Exception ex) { throw new Exception("DesignRequestDao.InsertDesignRequest-->" + ex.Message + sb.ToString(), ex); } }
public bool IsDesSelf(DesignRequestQuery drt) { try { return _DesignRequestDao.IsDesSelf(drt); } catch (Exception ex) { throw new Exception("DesignRequestMgr.IsDesSelf-->" + ex.Message, ex); } }
public HttpResponseBase DesignRequestEdit() { string json = string.Empty; DesignRequestQuery query = new DesignRequestQuery(); _DesignRequestMgr = new DesignRequestMgr(mySqlConnectionString); try { if (!string.IsNullOrEmpty(Request.Params["dr_id"])) { query.dr_id = Convert.ToUInt32(Request.Params["dr_id"]); } if (!string.IsNullOrEmpty(Request.Params["dr_content_text"])) { query.dr_content_text = Request.Params["dr_content_text"].ToString().Replace("\\", "\\\\"); } if (!string.IsNullOrEmpty(Request.Params["dr_description"])) { query.dr_description = Request.Params["dr_description"].Replace("\\", "\\\\"); } if (!string.IsNullOrEmpty(Request.Params["dr_document_path"])) { query.dr_document_path = Request.Params["dr_document_path"]; } if (!string.IsNullOrEmpty(Request.Params["dr_resource_path"])) { query.dr_resource_path = Request.Params["dr_resource_path"]; } if (!string.IsNullOrEmpty(Request.Params["product_id"])) { query.product_id = Convert.ToUInt32(Request.Params["product_id"]); } if (!string.IsNullOrEmpty(Request.Params["dr_type"])) { int num = 0; if (int.TryParse(Request.Params["dr_type"], out num)) { query.dr_type = num; } else { query.dr_type_tostring = Request.Params["dr_type"].ToString(); } } query.dr_created = DateTime.Now; query.dr_status = 1; query.dr_requester_id = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; json = _DesignRequestMgr.DesignRequestEdit(query); } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public int Getday(DesignRequestQuery query) { //獲取完成天數 string week =DateTime.Now.DayOfWeek.ToString(); int day = GetExpected(query); switch (day) { case 3: if (week == "Wednesday" || week == "Thursday" || week == "Friday") day = day + 2; break; case 2: if (week == "Thursday" || week == "Friday") day = day + 2; break; case 1: if (week == "Friday") day = day + 2; break; default: break; } return day; }
public int UpdateDesignRequest(DesignRequestQuery query) { StringBuilder sb = new StringBuilder(); query.Replace4MySQL(); try { sb.AppendFormat(@"UPDATE design_request SET dr_content_text='{0}',dr_description='{1}',dr_resource_path='{2}',dr_document_path='{3}',dr_type='{4}',product_id='{5}',dr_status='{6}' ", query.dr_content_text, query.dr_description, query.dr_resource_path, query.dr_document_path, query.dr_type, query.product_id,query.dr_status); if (query.day > 0) { sb.AppendFormat(@",dr_expected=DATE_ADD(NOW(),INTERVAL '{0}' DAY) ", query.day); } sb.AppendFormat(@"WHERE dr_id='{0}';", query.dr_id); return _accessMySql.execCommand(sb.ToString()); } catch (Exception ex) { throw new Exception("DesignRequestDao.UpdateDesignRequest-->" + ex.Message + sb.ToString(), ex); } }