示例#1
0
 public int SaveEmsGoal(EmsGoalQuery query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         query.Replace4MySQL();
         sql.Append("insert into ems_goal (`department_code`,`year`,`month`,`goal_amount`,`status`,`create_time`,`create_user`) ");
         sql.AppendFormat(" VALUES('{0}',{1} ,{2} ,{3} ,{4},'{5}',{6}); ",query.department_code,query.year,query.month,query.goal_amount,query.status,CommonFunction.DateTimeToString(query.create_time),query.user_userid);
         return _access.execCommand(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("EmsDao-->SaveEmsGoal-->"+sql.ToString()+ex.Message,ex);
     }
  
 }
示例#2
0
 //目標業績列表頁
 public HttpResponseBase GetEmsGoalList()
 {
     List<EmsGoalQuery> store = new List<EmsGoalQuery>();
     EmsGoalQuery query = new EmsGoalQuery();
     int totalCount = 0;
     string json = string.Empty;
     _IEmsMgr = new EmsMgr(mySqlConnectionString);
     query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
     query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["departgoal"]))
         {
             query.department_code = Request.Params["departgoal"].ToString();
         }
         //if (!string.IsNullOrEmpty(Request.Params["searchDategoal"]))
         //{
         //    query.searchdate = Convert.ToInt32(Request.Params["searchDategoal"].ToString());
         //}
         if (!string.IsNullOrEmpty(Request.Params["dategoal"]))
         {
             query.date = Convert.ToDateTime(Request.Params["dategoal"].ToString());
         }
         store = _IEmsMgr.GetEmsGoalList(query, out totalCount);
         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;
 }
示例#3
0
 public int EditEmsGoal(EmsGoalQuery query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         query.Replace4MySQL();
         sql.AppendFormat("update ems_goal set goal_amount={0} where row_id={1};",query.goal_amount,query.row_id);
         return _access.execCommand(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("EmsDao-->EditEmsGoal-->" + sql.ToString() + ex.Message, ex);
     }
 }
示例#4
0
 public int VerifyData(EmsGoalQuery query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         query.Replace4MySQL();
         sql.AppendFormat("select count(eg.row_id) as totalCount from ems_goal eg where eg.`year`={0} and eg.`month`={1} and  eg.department_code='{2}'; ", query.year, query.month,query.department_code);
         DataTable _dt = _access.getDataTable(sql.ToString());
         return Convert.ToInt32(_dt.Rows[0]["totalCount"]);
     }
     catch (Exception ex)
     {
         throw new Exception("EmsDao-->VerifyData-->"+sql.ToString()+ex.Message,ex);
     }
 }
示例#5
0
  //編輯目標業績
 public HttpResponseBase EditEmsGoal()
 {
     string json = string.Empty;
     try
     {
          EmsGoalQuery EgQuery = new EmsGoalQuery();
          _IEmsMgr = new EmsMgr(mySqlConnectionString);
          if (!string.IsNullOrEmpty(Request.Params["EmsValue"]))
          {
              EgQuery.goal_amount = Convert.ToInt32(Request.Params["EmsValue"]);
          }
          EgQuery.row_id = Convert.ToInt32(Request.Params["id"]);
          json= _IEmsMgr.EditEmsGoal(EgQuery);
     }
     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;
        
 }
示例#6
0
  //保存目標業績
 public HttpResponseBase SaveEmsGoal()
 {
     string json = string.Empty;
     EmsGoalQuery query = new EmsGoalQuery();
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["department_code"]))
         {
             query.department_code = Request.Params["department_code"].ToString();
         }
         if (!string.IsNullOrEmpty(Request.Params["year"]))
         {
              query.year = Convert.ToInt32(Request.Params["year"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["month"]))
         {
             query.month = Convert.ToInt32(Request.Params["month"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["goal_amount"]))
         {
             query.goal_amount = Convert.ToInt32(Request.Params["goal_amount"]);
         }
         query.create_time = DateTime.Now;
         query.user_userid = (Session["caller"] as Caller).user_id;
          string time = query.year + "-" + query.month;
          //DateTime now = DateTime.Now;
          //DateTime pre = Convert.ToDateTime(time);
          _IEmsMgr = new EmsMgr(mySqlConnectionString);
           json = _IEmsMgr.SaveEmsGoal(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:true,msg:2}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }