/// <summary> /// 查询内容 /// </summary> /// <param name="strWhere"></param> /// <returns></returns> public string GetContent(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Content from Personal_Score"); strSql.Append(" where " + strWhere); return(DbHelperMySQL.GetSingles(strSql.ToString()).ToString()); }
/// <summary> /// 跟进项目ID查询项目的状态 /// </summary> /// <param name="strWhere"></param> /// <returns></returns> public string GetStatus(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select task_status_name from crm_task"); strSql.Append(" where " + strWhere); return(DbHelperMySQL.GetSingles(strSql.ToString()).ToString()); }
/// <summary> /// 查询积分 /// </summary> /// <param name="strWhere"></param> /// <returns></returns> public string GetScore(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select score from ims_emp_score"); strSql.Append(" where " + strWhere); return(DbHelperMySQL.GetSingles(strSql.ToString()).ToString()); }
/// <summary> /// 得到公共客户的数量 /// </summary> /// <param name="strWhere"></param> /// <returns></returns> public int getPublicNum(string strWhere) { StringBuilder strSql = new StringBuilder(); int count = 0; strSql.Append("select count(id) from CRM_Customer "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } count = Convert.ToInt32(DbHelperMySQL.GetSingles(strSql.ToString())); return(count); }
/// <summary> ///更改项目的状态为已完成 /// </summary> /// <param name="strWhere"></param> /// <returns></returns> public bool UpdateStatus(XHD.Model.crm_task model) { List <string> strSqlList = new List <string>(); string okrsId = string.Empty; //循环查询子级 DataSet dt = _okrs.GetList("task_Id=" + model.Id); if (dt != null && dt.Tables[0].Rows.Count > 0) { for (int i = 0; i < dt.Tables[0].Rows.Count; i++) { if (i == dt.Tables[0].Rows.Count - 1) { okrsId += dt.Tables[0].Rows[i]["Id"].ToString(); } else { okrsId += dt.Tables[0].Rows[i]["Id"].ToString() + ","; } } } DataSet ds = _okrs.GetList("factory_Id='" + model.factory_id + "'"); string idList = okrsId; if (getOkrIDList(okrsId, ds.Tables[0]) != "") { idList += "," + getOkrIDList(okrsId, ds.Tables[0]); } int task_status_id = (int)DbHelperMySQL.GetSingles("select id from Param_SysParam where params_name='" + model.task_status_name + "' and parentid=16 and Factory_Id=" + model.factory_id + " limit 1"); //修改主表中的状态 string strSql = string.Format(@"Update crm_task set task_status_name='{0}',task_status_id='{1}',update_id='{2}',update_name='{3}',update_time='{4}',real_time='{5}',delay_time='{6}' where Id='{7}'", model.task_status_name, task_status_id, model.update_id, model.update_name, model.update_time, model.update_time, model.update_time - model.pre_time, model.Id); strSqlList.Add(strSql); if (!string.IsNullOrEmpty(okrsId)) { //修改子表中的状态 DataSet dtokrs = _okrs.GetList(" Id in (" + idList + ")"); if (dt != null && dtokrs.Tables[0].Rows.Count > 0) { for (int i = 0; i < dtokrs.Tables[0].Rows.Count; i++) { if (dtokrs.Tables[0].Rows[i]["task_status_name"].ToString() != "已完成" || dtokrs.Tables[0].Rows[i]["real_time"].ToString() == "0") { //strSql = string.Format(@"Update crm_task_okrs set task_status_name='{0}',task_status_id='{1}',update_id='{2}',update_name='{3}',update_time='{4}',real_time='{5}' where Id in ({6})", // model.task_status_name, task_status_id, model.update_id, model.update_name, model.update_time, model.update_time, idList); strSql = string.Format(@"Update crm_task_okrs set task_status_name='{0}',task_status_id='{1}',update_id='{2}',update_name='{3}',update_time='{4}',real_time='{5}' where Id ='{6}'", model.task_status_name, task_status_id, model.update_id, model.update_name, model.update_time, model.update_time, dtokrs.Tables[0].Rows[i]["Id"].ToString()); strSqlList.Add(strSql); } } } } int rows = DbHelperMySQL.ExecuteSqlTran(strSqlList); if (rows >= 0) { return(true); } else { return(false); } }