private DataTable GetData() { var data = new ApplicationUserProfileImageDataModel(); var dt = Framework.Components.ApplicationUser.ApplicationUserProfileImageDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
protected override void ShowData(int applicationUserProfileImageId) { base.ShowData(applicationUserProfileImageId); oDetailButtonPanel.SetId = SetId; Clear(); var dataQuery = new ApplicationUserProfileImageDataModel(); dataQuery.ApplicationUserProfileImageId = applicationUserProfileImageId; var entityList = Framework.Components.ApplicationUser.ApplicationUserProfileImageDataManager.GetEntityDetails(dataQuery, SessionVariables.RequestProfile); if (entityList.Count == 1) { foreach (var entityItem in entityList) { lblApplicationUserProfileImageId.Text = entityItem.ApplicationUserProfileImageId.ToString(); lblApplicationUserName.Text = entityItem.ApplicationUserName.ToString(); lblApplication.Text = entityItem.Application.ToString(); imgApplicationUserImage.ImageUrl = "~/Shared/AuthenticationAndAuthorization/ApplicationUserProfileImage/ShowImage.aspx?imageid=" + entityItem.ApplicationUserProfileImageId.ToString(); oUpdateInfo.LoadText(entityItem.UpdatedDate, entityItem.UpdatedBy, entityItem.LastAction); oHistoryList.Setup(PrimaryEntity, applicationUserProfileImageId, "ApplicationUserProfileImage"); } } }
public override int?Save(string action) { var data = new ApplicationUserProfileImageDataModel(); data.ApplicationUserProfileImageId = ApplicationUserProfileImageId; data.ApplicationId = ApplicationId; data.Image = Image; data.ApplicationUserId = ApplicationUserId; if (action == "Insert") { var dt = Framework.Components.ApplicationUser.ApplicationUserProfileImageDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dt.Rows.Count == 0) { Framework.Components.ApplicationUser.ApplicationUserProfileImageDataManager.Create(data, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { Framework.Components.ApplicationUser.ApplicationUserProfileImageDataManager.Update(data, SessionVariables.RequestProfile); } // not correct ... when doing insert, we didn't get/change the value of ClientID ? return(data.ApplicationUserProfileImageId); }
public static DataTable DoesExist(ApplicationUserProfileImageDataModel data, RequestProfile requestProfile) { var doesExistRequest = new ApplicationUserProfileImageDataModel(); doesExistRequest.ApplicationId = data.ApplicationId; return(Search(doesExistRequest, requestProfile)); }
private System.Data.DataTable GetProfileImageData(int ApplicationUserid) { var data = new ApplicationUserProfileImageDataModel(); data.ApplicationUserId = ApplicationUserid; var dt = Framework.Components.ApplicationUser.ApplicationUserProfileImageDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
private System.Data.DataTable GetData() { // TODO: on all export pages var data = new ApplicationUserProfileImageDataModel(); var dt = Framework.Components.ApplicationUser.ApplicationUserProfileImageDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
protected override void Clear() { base.Clear(); var data = new ApplicationUserProfileImageDataModel(); ApplicationUserProfileImageId = data.ApplicationUserProfileImageId; ApplicationId = data.ApplicationId; ApplicationUserId = data.ApplicationUserId; }
public static bool DoesExist(ApplicationUserProfileImageDataModel data, RequestProfile requestProfile) { var doesExistRequest = new ApplicationUserProfileImageDataModel(); doesExistRequest.ApplicationId = data.ApplicationId; var list = GetEntityDetails(doesExistRequest, requestProfile, 0); return(list.Count > 0); }
public static DataTable GetDetails(ApplicationUserProfileImageDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.ApplicationUserProfileImageSearch " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + //", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ReturnAuditInfo,BaseDataManager.ReturnAduitInfoOnDetails) + ", " + ToSQLParameter(data, ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserProfileImageId); var oDT = new DataAccess.DBDataTable("ApplicationUserProfileImage.Details", sql, DataStoreKey); return(oDT.DBTable); }
public static void Update(ApplicationUserProfileImageDataModel data, RequestProfile requestProfile) { var sql = "ApplicationUserProfileImageUpdate"; var parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId)); parameters.Add(new SqlParameter(ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserProfileImageId, data.ApplicationUserProfileImageId)); parameters.Add(new SqlParameter(ApplicationUserProfileImageDataModel.DataColumns.ApplicationId, data.ApplicationId)); parameters.Add(new SqlParameter(ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserId, data.ApplicationUserId)); parameters.Add(new SqlParameter(ApplicationUserProfileImageDataModel.DataColumns.Image, data.Image)); DataAccess.DBDML.RunSQLWithParameters("ApplicationUserProfileImage.Insert", sql, parameters.ToArray(), DataStoreKey); }
public static DataTable Search(ApplicationUserProfileImageDataModel data, RequestProfile requestProfile) { // formulate SQL var sql = "EXEC dbo.ApplicationUserProfileImageSearch " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationMode, requestProfile.ApplicationModeId) + ", " + ToSQLParameter(data, ApplicationUserProfileImageDataModel.DataColumns.ApplicationId) + ", " + ToSQLParameter(data, ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserProfileImageId) + ", " + ToSQLParameter(data, ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserId); var oDT = new DataAccess.DBDataTable("ApplicationUserProfileImage.Search", sql, DataStoreKey); return(oDT.DBTable); }
public static void Delete(ApplicationUserProfileImageDataModel dataQuery, RequestProfile requestProfile) { const string sql = @"dbo.ApplicationUserProfileImageDelete "; var parameters = new { AuditId = requestProfile.AuditId , ApplicationUserProfileImageId = dataQuery.ApplicationUserProfileImageId }; using (var dataAccess = new DataAccessBase(DataStoreKey)) { dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure); } }
protected void Page_Load(object sender, EventArgs e) { int imageId = Convert.ToInt32(Request.QueryString["imageid"]); var data = new ApplicationUserProfileImageDataModel(); data.ApplicationUserProfileImageId = imageId; var dt = Framework.Components.ApplicationUser.ApplicationUserProfileImageDataManager.GetDetails(data, SessionVariables.RequestProfile); if (dt.Rows.Count > 0) { var imageData = ((byte[])(dt.Rows[0][ApplicationUserProfileImageDataModel.DataColumns.Image])); Response.Clear(); Response.ContentType = "image/pjpeg"; Response.BinaryWrite(imageData); Response.End(); } }
protected void btnDelete_Click(object sender, EventArgs e) { try { string[] deleteIndexList = DeleteIds.Split(','); foreach (string index in deleteIndexList) { var data = new ApplicationUserProfileImageDataModel(); data.ApplicationUserProfileImageId = int.Parse(index); Framework.Components.ApplicationUser.ApplicationUserProfileImageDataManager.Delete(data, SessionVariables.RequestProfile); } DeleteAndRedirect(); } catch (Exception ex) { Response.Write(ex.Message); } }
public static List <ApplicationUserProfileImageDataModel> GetEntityDetails(ApplicationUserProfileImageDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails) { const string sql = @"dbo.ApplicationUserProfileImageSearch "; var parameters = new { ApplicationId = dataQuery.ApplicationId , ApplicationUserId = dataQuery.ApplicationUserId , ApplicationUserProfileImageId = dataQuery.ApplicationUserProfileImageId }; List <ApplicationUserProfileImageDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { result = dataAccess.Connection.Query <ApplicationUserProfileImageDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); } return(result); }
public void LoadData(int ApplicationUserProfileImageId, bool showId) { var data = new ApplicationUserProfileImageDataModel(); data.ApplicationUserProfileImageId = ApplicationUserProfileImageId; var oApplicationUserProfileImageTable = Framework.Components.ApplicationUser.ApplicationUserProfileImageDataManager.GetDetails(data, SessionVariables.RequestProfile); if (oApplicationUserProfileImageTable.Rows.Count == 1) { var row = oApplicationUserProfileImageTable.Rows[0]; if (!showId) { txtApplicationUserProfileImageId.Text = Convert.ToString(row[ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserProfileImageId]); dynAuditHistory.Visible = true; // only show Audit History in case of Update page, not for Clone. oHistoryList.Setup((int)Framework.Components.DataAccess.SystemEntity.ApplicationUserProfileImage, ApplicationUserProfileImageId, "ApplicationUserProfileImage"); dynAuditHistory.Visible = PerferenceUtility.GetUserPreferenceByKeyAsBoolean(ApplicationCommon.HistoryGridVisibilityKey, "ApplicationUserProfileImage"); } else { txtApplicationUserProfileImageId.Text = String.Empty; } txtApplicationUser.Text = Convert.ToString(row[ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserId]); txtApplication.Text = Convert.ToString(row[BaseDataModel.BaseDataColumns.ApplicationId]); drpApplication.Text = Convert.ToString(row[BaseDataModel.BaseDataColumns.ApplicationId]); drpApplicationUser.SelectedValue = Convert.ToString(row[ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserId]); oUpdateInfo.LoadText(oApplicationUserProfileImageTable.Rows[0]); } else { txtApplicationUserProfileImageId.Text = String.Empty; txtApplicationUser.Text = String.Empty; txtApplication.Text = String.Empty; } }
private static string CreateOrUpdate(ApplicationUserProfileImageDataModel data, RequestProfile requestProfile, string action) { var sql = "EXEC "; switch (action) { case "Create": sql += "dbo.ApplicationUserProfileImageInsert " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId); break; case "Update": sql += "dbo.ApplicationUserProfileImageUpdate " + " "; break; default: break; } sql = sql + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserProfileImageId) + ", " + ToSQLParameter(data, ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserId) + ", " + ToSQLParameter(data, ApplicationUserProfileImageDataModel.DataColumns.Image); return(sql); }
public static ApplicationUserProfileImageDataModel GetDetails(ApplicationUserProfileImageDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 1); return(list.FirstOrDefault()); }
public static string ToSQLParameter(ApplicationUserProfileImageDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserProfileImageId: if (data.ApplicationUserProfileImageId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserProfileImageId, data.ApplicationUserProfileImageId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserProfileImageId); } break; case ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserId: if (data.ApplicationUserId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserId, data.ApplicationUserId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserId); } break; case ApplicationUserProfileImageDataModel.DataColumns.Image: if (data.Image != null) { returnValue = Convert.ToString(data.Image); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ApplicationUserProfileImageDataModel.DataColumns.Image); } break; case ApplicationUserProfileImageDataModel.DataColumns.ApplicationId: if (data.ApplicationId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, ApplicationUserProfileImageDataModel.DataColumns.ApplicationId, data.ApplicationId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ApplicationUserProfileImageDataModel.DataColumns.ApplicationId); } break; case ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserName: if (!string.IsNullOrEmpty(data.ApplicationUserName)) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserName, data.ApplicationUserName); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ApplicationUserProfileImageDataModel.DataColumns.ApplicationUserName); } break; case ApplicationUserProfileImageDataModel.DataColumns.Application: if (!string.IsNullOrEmpty(data.Application)) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, ApplicationUserProfileImageDataModel.DataColumns.Application, data.Application); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ApplicationUserProfileImageDataModel.DataColumns.Application); } break; default: returnValue = BaseDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }