/// <summary> /// 人員管理 /// </summary> /// <returns></returns> public HttpResponseBase AddCallid()//modify by mengjuan0826j 2015/6/8 處理供應商pm設定 增加條件設置:若pm存在于供應商,則不能執行刪除動作! { gcMgr = new GroupCallerMgr(mySqlConnectionString); venMgr = new VendorMgr(mySqlConnectionString); string json = string.Empty; bool delete = true; try { if (!string.IsNullOrEmpty(Request.Form["groupId"])) { gc.groupId = Int32.Parse(Request.Form["groupId"]); } if (!string.IsNullOrEmpty(Request.Form["callid"])) { string[] callid = Request.Form["callid"].IndexOf(",") != -1 ? Request.Form["callid"].Split(',') : new string[] { Request.Form["callid"] }; if (gc.groupId == GetVebdorPMGroup())//判定是否為供應商群組管理員 { List<ManageUser> muStore = venMgr.GetVendorPM();//獲取供應商pm if (muStore.Count != 0) { foreach (var item in muStore)//遍歷供應商pm,若該人員存在于供應商pm,則不能刪除,直接提示! { if (!callid.Contains(item.user_email)) { delete = false; json = "{success:false,msg:\"人員 " + item.user_username + " 為現有供應商PM,不能移除\"}"; break; } } } } if (delete) { gcMgr.Delete(gc); foreach (string id in callid) { if (!string.IsNullOrEmpty(id)) { gc.callid = id; gcMgr.Save(gc); } } json = "{success:true,msg:\"新增成功\"}"; } } else { json = "{success:true,msg:\"新增失敗\"}"; } } 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:true,msg:\"新增失败\"}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public string QueryPm() { gcMgr = new GroupCallerMgr(connectionString); paraMgr = new ParameterMgr(connectionString); fgMgr = new FgroupMgr(connectionString); muMgr = new ManageUserMgr(connectionString); groupCaller gc = new groupCaller(); Fgroup fg = new Fgroup(); string json = string.Empty; try { List<Parametersrc> parstore = paraMgr.QueryUsed(new Parametersrc { ParameterType = "vendor_pm" }).ToList(); if (parstore.Count != 0) { fg.groupCode = parstore[0].ParameterCode; // fg.groupName = parstore[0].parameterName;//parameterName是可變的不可依此查詢 edit by shuangshuang0420j 2015.07.28 09:48 Fgroup pmfg = fgMgr.GetSingle(fg); if (pmfg != null) { gc.groupId = pmfg.rowid; string pm = gcMgr.QueryCallidById(gc); StringBuilder stb = new StringBuilder(""); stb.Append("{"); stb.Append("success:true,item:["); //stb.Append("{"); //stb.AppendFormat("\"userId\":\"{0}\",\"userName\":\"{1}\"", 0, "請選擇"); //stb.Append("}"); string nameStr = string.Empty; string[] pmar = pm.Split(',').ToArray(); foreach (var item in pmar) { int total = 0; ManageUserQuery mu = muMgr.GetManageUserList(new ManageUserQuery { user_email = item, search_status = "-1" }, out total).FirstOrDefault(); if (total == 1 && mu != null) { stb.Append("{"); stb.AppendFormat("\"userId\":\"{0}\",\"userName\":\"{1}\"", mu.user_id, mu.user_username); stb.Append("}"); } } stb.Append("]}"); json = stb.ToString().Replace("}{", "},{"); } //else //{ // json = "{success:false,error:1}"; //} } //else //{ // json = "{success:false,error:0}"; //} } 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 = "[]"; } return json; }
public string QueryCallidById() { gcMgr = new GroupCallerMgr(mySqlConnectionString); string json = string.Empty; try { if (!string.IsNullOrEmpty(Request.Form["groupId"])) { gc.groupId = Convert.ToInt32(Request.Form["groupId"]); } json = gcMgr.QueryCallidById(gc); } 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 = "[]"; } return json; }