Esempio n. 1
0
        private void AddUpdate()
        {
            string         strJson     = new StreamReader(HttpContext.Current.Request.InputStream).ReadToEnd();
            Position_DTO   objInfo     = JsonConvert.DeserializeObject <Position_DTO>(strJson);
            int            result      = 0;
            ResponseResult objResponse = new ResponseResult();

            if ((objInfo != null))
            {
                if ((objInfo.PositionID < 1))
                {
                    result                  = objImpl.Insert(objInfo);
                    objResponse.d           = Convert.ToString(result);
                    objResponse.msg         = "Thêm mới thành công!";
                    objResponse.hasExecuted = true;
                    objResponse.c           = 1;
                }
                else
                {
                    result                  = objImpl.Update(objInfo);
                    objResponse.d           = Convert.ToString(result);
                    objResponse.msg         = "Sửa thành công!";
                    objResponse.hasExecuted = true;
                    objResponse.c           = 1;
                }
            }
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(objResponse));
            HttpContext.Current.Response.End();
        }
Esempio n. 2
0
 public int Insert(Position_DTO obj)
 {
     return(Int32.Parse(SqlHelper.ExecuteScalarOfT("Position_Insert", obj).ToString()));
 }
Esempio n. 3
0
 public int Update(Position_DTO obj)
 {
     return(SqlHelper.ExecuteNonQueryOfT("Position_Update", obj));
 }
Esempio n. 4
0
 public int Insert(Position_DTO obj)
 {
     return(objPositon_DAL.Insert(obj));
 }
Esempio n. 5
0
 public int Update(Position_DTO obj)
 {
     return(objPositon_DAL.Update(obj));
 }