Пример #1
0
        public async Task <dynamic> DeleteOwnerLevel(DSM_OwnerLevel menu)
        {
            action     = "delete";
            respStatus = await Task.Run(() => _ownerLevelService.AddOwnerLevel(menu, action, out outStatus));

            return(Json(new { Message = respStatus.Message, respStatus }, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
 public ValidationResult AddOwnerLevel(DSM_OwnerLevel ownerLevel, string action, out string status)
 {
     ownerLevelDataService.AddOwnerLevel(ownerLevel, action, out status);
     if (status.Length > 0)
     {
         return(new ValidationResult(status, localizationService.GetResource(status)));
     }
     return(ValidationResult.Success);
 }
Пример #3
0
        public async Task <dynamic> EditOwnerLevel(DSM_OwnerLevel obOwnerLevel)
        {
            if (ModelState.IsValid)
            {
                action                  = "edit";
                obOwnerLevel.SetBy      = UserID;
                obOwnerLevel.ModifiedBy = obOwnerLevel.SetBy;
                respStatus              = await Task.Run(() => _ownerLevelService.AddOwnerLevel(obOwnerLevel, action, out outStatus));

                return(Json(new { Message = respStatus.Message, respStatus }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                respStatus = new ValidationResult("E404", _localizationService.GetResource("E404"));
            }
            return(Json(new { Message = respStatus.Message, respStatus }, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
 public string AddOwnerLevel(DSM_OwnerLevel ownerLevel, string action, out string errorNumber)
 {
     errorNumber = String.Empty;
     try
     {
         DatabaseProviderFactory factory = new DatabaseProviderFactory();
         SqlDatabase             db      = factory.CreateDefault() as SqlDatabase;
         using (DbCommand dbCommandWrapper = db.GetStoredProcCommand("SetOwnerLevel"))
         {
             // Set parameters
             db.AddInParameter(dbCommandWrapper, "@OwnerLevelID", SqlDbType.NVarChar, ownerLevel.OwnerLevelID);
             db.AddInParameter(dbCommandWrapper, "@LevelName", SqlDbType.NVarChar, ownerLevel.LevelName.Trim());
             db.AddInParameter(dbCommandWrapper, "@LevelAccess ", SqlDbType.NVarChar, ownerLevel.LevelAccess == null?"":ownerLevel.LevelAccess.Trim());
             db.AddInParameter(dbCommandWrapper, "@LevelSL", SqlDbType.NVarChar, ownerLevel.LevelSL);
             db.AddInParameter(dbCommandWrapper, "@UserLevel", SqlDbType.Int, ownerLevel.UserLevel);
             db.AddInParameter(dbCommandWrapper, "@SetBy ", SqlDbType.NVarChar, ownerLevel.SetBy);
             db.AddInParameter(dbCommandWrapper, "@ModifiedBy", SqlDbType.NVarChar, ownerLevel.ModifiedBy);
             db.AddInParameter(dbCommandWrapper, "@Status", SqlDbType.Int, ownerLevel.Status);
             db.AddInParameter(dbCommandWrapper, "@Action", SqlDbType.VarChar, action);
             db.AddOutParameter(dbCommandWrapper, spStatusParam, SqlDbType.VarChar, 10);
             // Execute SP.
             db.ExecuteNonQuery(dbCommandWrapper);
             // Getting output parameters and setting response details.
             if (!db.GetParameterValue(dbCommandWrapper, spStatusParam).IsNullOrZero())
             {
                 // Get the error number, if error occurred.
                 errorNumber = db.GetParameterValue(dbCommandWrapper, spStatusParam).PrefixErrorCode();
             }
         }
     }
     catch (Exception ex)
     {
         errorNumber = "E404"; // Log ex.Message  Insert Log Table
     }
     return(errorNumber);
 }