//Add for PUblish... public void SetCountOfLogin(int userId) { var sqlParams = new List <SqlParameter>(); sqlParams.Add(new SqlParameter() { ParameterName = "@UserId", SqlValue = 1 }); ExecuteSpRp.ExecuteSp(GeneralSpName.SpUpdateCountOfUserLogin, sqlParams, ContextBase); }
public int Delete(int id, string userName) { var dtResult = CheckRelationBeforeDelete(string.Format("{0}.{1}", Schema, TableName), KeyName, id.ToString()); if (dtResult.Count >= 1) { var s = new StringBuilder(); s.Append(" این رکورد در جداول"); s.Append("<br/>"); foreach (var item in dtResult) { s.Append("<br/>"); s.Append(item.inUsedTbName); } s.Append("در حال استفاده می باشد"); throw new Exception(s.ToString(), new Exception(s.ToString(), null)); } var userProfile = ContextBase.Set <UserProfile>().SingleOrDefault(a => a.UserName.ToLower() == userName); var sqlParams = new List <SqlParameter>(); sqlParams.Add(new SqlParameter( ) { ParameterName = "@companyId", SqlValue = id }); sqlParams.Add(new SqlParameter() { ParameterName = "@currentUserId", SqlValue = userProfile.User.Id }); return((int)ExecuteSpRp.ExecuteSp(GeneralSpName.DeleteChartCompany, sqlParams, ContextBase)); // return _dbContextBase.Database.ExecuteSqlCommand("EXEC DeleteChartOrganization @organizationId", ietsParameter); }
public int Delete(int id, string userName) { var dtResult = CheckRelationBeforeDelete(string.Format("{0}.{1}", Schema, TableName), KeyName, id.ToString()); if (dtResult.Count >= 1) { var s = new StringBuilder(); s.Append(" این رکورد در جداول"); s.Append("<br/>"); foreach (var item in dtResult) { s.Append("<br/>"); s.Append(item.inUsedTbName); s.Append("<br/>"); } s.Append("در حال استفاده می باشد"); throw new Exception(s.ToString(), new Exception(s.ToString(), null)); } var sqlParams = new List <SqlParameter>(); var user = ContextBase.Set <User>().AsNoTracking().Include("UserProfile").SingleOrDefault(a => a.UserProfile.UserName.ToLower() == userName.ToLower()); sqlParams.Add(new SqlParameter() { ParameterName = "@ViewElementId ", SqlValue = id }); sqlParams.Add(new SqlParameter() { ParameterName = "@currentUserId", SqlValue = user.Id }); return((int)ExecuteSpRp.ExecuteSp(GeneralSpName.ViewElementMenu, sqlParams, (IDbContextBase)ContextBase)); }