public static DBgl_UserInfoCollection GetAllItem() { string key = SETTINGS_ALL_KEY; object obj2 = dtpCache.Get(key); if ((obj2 != null)) { return((DBgl_UserInfoCollection)obj2); } DBgl_UserInfoCollection ItemCollection = new DBgl_UserInfoCollection(); Database db = SqlHelper.CreateConnection(SqlHelper.MyConnection); DbCommand dbCommand = db.GetStoredProcCommand("gl_UserInfo_GetAll"); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBgl_UserInfo item = GetItemFromReader(dataReader); ItemCollection.Add(item); } } dtpCache.Max(key, ItemCollection); return(ItemCollection); }
private static DBgl_UserInfo GetItemFromReader(IDataReader dataReader) { DBgl_UserInfo objItem = new DBgl_UserInfo(); objItem.UserInfId = SqlHelper.GetInt(dataReader, "UserInfId"); objItem.UserId = SqlHelper.GetInt(dataReader, "UserId"); objItem.UserName = SqlHelper.GetString(dataReader, "UserName"); objItem.CreatedDate = SqlHelper.GetDateTime(dataReader, "CreatedDate"); objItem.Mobile = SqlHelper.GetString(dataReader, "Mobile"); objItem.CountryId = SqlHelper.GetInt(dataReader, "CountryId"); objItem.LocationId = SqlHelper.GetInt(dataReader, "LocationId"); objItem.Address = SqlHelper.GetString(dataReader, "Address"); objItem.Rating = SqlHelper.GetInt(dataReader, "Rating"); objItem.MyLegs = SqlHelper.GetInt(dataReader, "MyLegs"); objItem.EnjoyLegs = SqlHelper.GetInt(dataReader, "EnjoyLegs"); objItem.Sex = SqlHelper.GetBoolean(dataReader, "Sex"); objItem.createdUser = SqlHelper.GetString(dataReader, "createdUser"); return(objItem); }
public static DBgl_UserInfo GetItemByUserName(string UserName) { string key = String.Format(SETTINGS_User_KEY, UserName); object obj2 = dtpCache.Get(key); if (obj2 != null) { return((DBgl_UserInfo)obj2); } DBgl_UserInfo item = null; Database db = SqlHelper.CreateConnection(SqlHelper.MyConnection); DbCommand dbCommand = db.GetStoredProcCommand("gl_UserInfo_GetByUserName"); db.AddInParameter(dbCommand, "UserName", DbType.String, UserName); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { item = GetItemFromReader(dataReader); } } dtpCache.Max(key, item); return(item); }
public static DBgl_UserInfo UpdateLegs(string strUserName) { DBgl_UserInfo objInfo = DBgl_UserInfoManager.GetItemByUserName(strUserName); if (objInfo != null) { int joinlegs = objInfo.EnjoyLegs + 1; objInfo = DBgl_UserInfoManager.UpdateItem(objInfo.UserInfId, objInfo.UserId, objInfo.UserName, objInfo.CreatedDate, objInfo.Mobile, objInfo.CountryId, objInfo.LocationId, objInfo.Address, objInfo.Rating, objInfo.MyLegs, joinlegs, objInfo.Sex, objInfo.createdUser); } return(objInfo); }
public static int DeleteItem(int ItemId) { Database db = SqlHelper.CreateConnection(SqlHelper.MyConnection); DbCommand dbCommand = db.GetStoredProcCommand("gl_UserInfo_Delete"); db.AddInParameter(dbCommand, "UserInfId", DbType.Int32, ItemId); DBgl_UserInfo item = GetItemByID(ItemId); if (item != null) { RemoveCache(item); } return(db.ExecuteNonQuery(dbCommand)); }
public static DBgl_UserInfo AddItem(int UserId, string UserName, DateTime CreatedDate, string Mobile, int CountryId, int LocationId, string Address, int Rating, int MyLegs, int EnjoyLegs, bool Sex, string createdUser) { DBgl_UserInfo item = null; Database db = SqlHelper.CreateConnection(SqlHelper.MyConnection); DbCommand dbCommand = db.GetStoredProcCommand("gl_UserInfo_Add"); db.AddOutParameter(dbCommand, "UserInfId", DbType.Int64, 0); db.AddInParameter(dbCommand, "UserId", DbType.Int64, UserId); db.AddInParameter(dbCommand, "UserName", DbType.String, UserName); db.AddInParameter(dbCommand, "CreatedDate", DbType.DateTime, CreatedDate); db.AddInParameter(dbCommand, "Mobile", DbType.String, Mobile); db.AddInParameter(dbCommand, "CountryId", DbType.Int32, CountryId); db.AddInParameter(dbCommand, "LocationId", DbType.Int32, LocationId); db.AddInParameter(dbCommand, "Address", DbType.String, Address); db.AddInParameter(dbCommand, "Rating", DbType.Int32, Rating); db.AddInParameter(dbCommand, "MyLegs", DbType.Int32, MyLegs); db.AddInParameter(dbCommand, "EnjoyLegs", DbType.Int32, EnjoyLegs); db.AddInParameter(dbCommand, "Sex", DbType.Boolean, Sex); db.AddInParameter(dbCommand, "createdUser", DbType.String, createdUser); if (db.ExecuteNonQuery(dbCommand) > 0) { int itemID = Convert.ToInt32(db.GetParameterValue(dbCommand, "@UserInfId")); item = GetItemByID(itemID); if (item != null) { RemoveCache(item); } } return(item); }
public static DBgl_UserInfoCollection GetItemPagging(int page, int rec, string strSearch, out int TotalRecords) { TotalRecords = 0; DBgl_UserInfoCollection ItemCollection = new DBgl_UserInfoCollection(); Database db = SqlHelper.CreateConnection(SqlHelper.MyConnection); DbCommand dbCommand = db.GetStoredProcCommand("gl_UserInfo_Paging"); db.AddInParameter(dbCommand, "Page", DbType.Int32, page); db.AddInParameter(dbCommand, "RecsPerPage", DbType.Int32, rec); db.AddInParameter(dbCommand, "SearchValue", DbType.String, strSearch); db.AddOutParameter(dbCommand, "TotalRecords", DbType.Int32, 0); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBgl_UserInfo item = GetItemFromReader(dataReader); ItemCollection.Add(item); } } TotalRecords = Convert.ToInt32(db.GetParameterValue(dbCommand, "@TotalRecords")); return(ItemCollection); }
private static void RemoveCache(DBgl_UserInfo objItem) { dtpCache.RemoveByPattern(SETTINGS_ALL_KEY); dtpCache.RemoveByPattern(string.Format(SETTINGS_ID_KEY, objItem.UserInfId)); dtpCache.RemoveByPattern(string.Format(SETTINGS_User_KEY, objItem.UserName)); }
public static DBgl_Workflow AddItem(int WStatus, DateTime CreatedDate, string CreatedUser, bool Published, string WorkflowName, string SmallDesc, DateTime FromDate, DateTime ToDate, decimal BudgetAmt, decimal ReceiveAmt, decimal PaymentAmnt, decimal CashOnHandAmt, int Members, bool isClose, int Ratting, string ImgUrl, int SharingType) { DBgl_Workflow item = null; Database db = SqlHelper.CreateConnection(SqlHelper.MyConnection); DbCommand dbCommand = db.GetStoredProcCommand("gl_Workflow_Add"); db.AddOutParameter(dbCommand, "WorkflowID", DbType.Guid, 0); db.AddInParameter(dbCommand, "WStatus", DbType.Int32, WStatus); db.AddInParameter(dbCommand, "CreatedDate", DbType.DateTime, CreatedDate); db.AddInParameter(dbCommand, "CreatedUser", DbType.String, CreatedUser); db.AddInParameter(dbCommand, "Published", DbType.Boolean, Published); db.AddInParameter(dbCommand, "WorkflowName", DbType.String, HtmlTag.Strip(WorkflowName)); db.AddInParameter(dbCommand, "SmallDesc", DbType.String, SmallDesc); db.AddInParameter(dbCommand, "FromDate", DbType.DateTime, FromDate); db.AddInParameter(dbCommand, "ToDate", DbType.DateTime, ToDate); db.AddInParameter(dbCommand, "BudgetAmt", DbType.Decimal, BudgetAmt); db.AddInParameter(dbCommand, "ReceiveAmt", DbType.Decimal, ReceiveAmt); db.AddInParameter(dbCommand, "PaymentAmnt", DbType.Decimal, PaymentAmnt); db.AddInParameter(dbCommand, "CashOnHandAmt", DbType.Decimal, CashOnHandAmt); db.AddInParameter(dbCommand, "Members", DbType.Int32, Members); db.AddInParameter(dbCommand, "isClose", DbType.Boolean, isClose); db.AddInParameter(dbCommand, "Ratting", DbType.Int32, Ratting); db.AddInParameter(dbCommand, "ImgUrl", DbType.String, ImgUrl); db.AddInParameter(dbCommand, "SharingType", DbType.Int32, SharingType); if (db.ExecuteNonQuery(dbCommand) > 0) { Guid itemID = (Guid)(db.GetParameterValue(dbCommand, "@WorkflowID")); item = GetItemByID(itemID); if (item != null) { //add this user to Friend Request DBtblUser objUser = DBtblUserManager.GetItemByUser(CreatedUser); DBgl_FriendRequest objRequest = DBgl_FriendRequestManager.AddItem(objUser.Username, objUser.Username, objUser.Email, Guid.NewGuid(), DateTime.Now, objUser.Username, item.WorkflowID, true, true, false, 0, 0, "", (int)FriendRequestEnum.gl_Invited); //UPdate USerInfo Legs DBgl_UserInfo objInfo = DBgl_UserInfoManager.GetItemByUserName(CreatedUser); if (objInfo != null) { int joinlegs = objInfo.MyLegs + 1; int myenjoyLegs = objInfo.EnjoyLegs + 1; objInfo = DBgl_UserInfoManager.UpdateItem(objInfo.UserInfId, objInfo.UserId, objInfo.UserName, objInfo.CreatedDate, objInfo.Mobile, objInfo.CountryId, objInfo.LocationId, objInfo.Address, objInfo.Rating, joinlegs, myenjoyLegs, objInfo.Sex, objInfo.createdUser); } RemoveCache(item); } } return(item); }