Esempio n. 1
0
        public int Insert(OrgUserModel model)
        {
            string sql = "INSERT INTO [OrgUser]([UserID],[OrgID]) VALUES(@UserID,@OrgID)";

            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID", SqlDbType.VarChar),
                new SqlParameter("@OrgID",  SqlDbType.Int),
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.OrgID;

            return(DbHelperSQL.ExecuteSql(sql, parameters));
        }
Esempio n. 2
0
        public int Update(OrgUserModel model)
        {
            string sql = "UPDATE [OrgUser] SET [UserID]=@UserID,[OrgID]=@OrgID WHERE UserID=@UserID and OrgID=@OrgID";

            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID", SqlDbType.VarChar),
                new SqlParameter("@OrgID",  SqlDbType.Int),
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.OrgID;

            return(DbHelperSQL.ExecuteSql(sql, parameters));
        }
Esempio n. 3
0
        public JsonResult Update(OrgUserViewModel model)
        {
            try
            {
                OrgUserModel orgUserModel = orgUserBll.GetModel(model.UserID, model.OrgID);
                orgUserModel.UserID = model.UserID;
                orgUserModel.OrgID  = model.OrgID;

                orgUserBll.Update(orgUserModel);
                return(Json(new { code = 200 }));
            }
            catch (Exception ex)
            {
                return(Json(new { code = 500, msg = ex.Message }));
            }
        }
Esempio n. 4
0
        public JsonResult Insert(OrgUserViewModel model)
        {
            try
            {
                OrgUserModel orgUserModel = new OrgUserModel();
                orgUserModel.UserID = model.UserID;
                orgUserModel.OrgID  = model.OrgID;

                orgUserBll.Insert(orgUserModel);
                return(Json(new { code = 200 }));
            }
            catch (Exception ex)
            {
                return(Json(new { code = 500, msg = ex.Message }));
            }
        }
Esempio n. 5
0
        public OrgUserModel DataRowToModel(DataRow row)
        {
            OrgUserModel model = new OrgUserModel();

            if (row == null)
            {
                return(model);
            }

            if (row["UserID"] != null && row["UserID"].ToString() != "")
            {
                model.UserID = row["UserID"].ToString();
            }
            if (row["OrgID"] != null && row["OrgID"].ToString() != "")
            {
                model.OrgID = int.Parse(row["OrgID"].ToString());
            }

            return(model);
        }
Esempio n. 6
0
 public JsonResult Delete(string userID, int orgID)
 {
     try
     {
         OrgUserModel model = orgUserBll.GetModel(userID, orgID);
         if (model != null)
         {
             orgUserBll.Delete(userID, orgID);
         }
         else
         {
             return(Json(new { code = 500, msg = "parms is null" }));
         }
         return(Json(new { code = 200 }));
     }
     catch (Exception ex)
     {
         return(Json(new { code = 500, msg = ex.Message }));
     }
 }
Esempio n. 7
0
 public int Update(OrgUserModel model)
 {
     return(dal.Update(model));
 }
Esempio n. 8
0
 public int Insert(OrgUserModel model)
 {
     return(dal.Insert(model));
 }