Ejemplo n.º 1
0
        public static DBgl_WorkflowCollection GetAllItem()
        {
            string key  = SETTINGS_ALL_KEY;
            object obj2 = dtpCache.Get(key);

            if ((obj2 != null))
            {
                return((DBgl_WorkflowCollection)obj2);
            }
            DBgl_WorkflowCollection ItemCollection = new DBgl_WorkflowCollection();
            Database  db        = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            DbCommand dbCommand = db.GetStoredProcCommand("gl_Workflow_GetAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBgl_Workflow item = GetItemFromReader(dataReader);
                    ItemCollection.Add(item);
                }
            }

            dtpCache.Max(key, ItemCollection);

            return(ItemCollection);
        }
Ejemplo n.º 2
0
        public static DBgl_Workflow GetItemByID(Guid WorkflowID)
        {
            string key  = String.Format(SETTINGS_ID_KEY, WorkflowID);
            object obj2 = dtpCache.Get(key);

            if (obj2 != null)
            {
                return((DBgl_Workflow)obj2);
            }


            DBgl_Workflow item      = null;
            Database      db        = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            DbCommand     dbCommand = db.GetStoredProcCommand("gl_Workflow_GetByID");

            db.AddInParameter(dbCommand, "WorkflowID", DbType.Guid, WorkflowID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetItemFromReader(dataReader);
                }
            }
            dtpCache.Max(key, item);
            return(item);
        }
Ejemplo n.º 3
0
        public static DBgl_WorkflowCollection GetAllItemByCreatedUser(string createdUser)
        {
            string key  = String.Format(SETTINGS_CreatedUser_KEY, createdUser);
            object obj2 = dtpCache.Get(key);

            if ((obj2 != null))
            {
                return((DBgl_WorkflowCollection)obj2);
            }
            DBgl_WorkflowCollection ItemCollection = new DBgl_WorkflowCollection();
            Database  db        = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            DbCommand dbCommand = db.GetStoredProcCommand("gl_Workflow_GetAllByCreatedUser");

            db.AddInParameter(dbCommand, "CreatedUser", DbType.String, createdUser);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBgl_Workflow item = GetItemFromReader(dataReader);
                    ItemCollection.Add(item);
                }
            }

            dtpCache.Max(key, ItemCollection);

            return(ItemCollection);
        }
Ejemplo n.º 4
0
        public static DBgl_Workflow UpdateItem(Guid WorkflowID, 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_Update");

            db.AddInParameter(dbCommand, "WorkflowID", DbType.Guid, WorkflowID);

            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, 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)
            {
                item = GetItemByID(WorkflowID);
                if (item != null)
                {
                    RemoveCache(item);
                }
            }
            return(item);
        }
Ejemplo n.º 5
0
        public static DBgl_WorkflowCollection GetItemPagging(int page, int rec, string strSearch, out int TotalRecords)
        {
            TotalRecords = 0;
            DBgl_WorkflowCollection ItemCollection = new DBgl_WorkflowCollection();
            Database  db        = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            DbCommand dbCommand = db.GetStoredProcCommand("gl_Workflow_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_Workflow item = GetItemFromReader(dataReader);
                    ItemCollection.Add(item);
                }
            }
            TotalRecords = Convert.ToInt32(db.GetParameterValue(dbCommand, "@TotalRecords"));
            return(ItemCollection);
        }
Ejemplo n.º 6
0
        private static DBgl_Workflow GetItemFromReader(IDataReader dataReader)
        {
            DBgl_Workflow objItem = new DBgl_Workflow();

            objItem.WorkflowID = SqlHelper.GetGuid(dataReader, "WorkflowID");

            objItem.WStatus = SqlHelper.GetInt(dataReader, "WStatus");

            objItem.CreatedDate = SqlHelper.GetDateTime(dataReader, "CreatedDate");

            objItem.CreatedUser = SqlHelper.GetString(dataReader, "CreatedUser");

            objItem.Published = SqlHelper.GetBoolean(dataReader, "Published");

            objItem.WorkflowName = SqlHelper.GetString(dataReader, "WorkflowName");

            objItem.SmallDesc = SqlHelper.GetString(dataReader, "SmallDesc");

            objItem.FromDate = SqlHelper.GetDateTime(dataReader, "FromDate");

            objItem.ToDate    = SqlHelper.GetDateTime(dataReader, "ToDate");
            objItem.BudgetAmt = SqlHelper.GetDecimal(dataReader, "BudgetAmt");

            objItem.ReceiveAmt = SqlHelper.GetDecimal(dataReader, "ReceiveAmt");

            objItem.PaymentAmnt = SqlHelper.GetDecimal(dataReader, "PaymentAmnt");

            objItem.CashOnHandAmt = SqlHelper.GetDecimal(dataReader, "CashOnHandAmt");
            objItem.Members       = SqlHelper.GetInt(dataReader, "Members");

            objItem.isClose = SqlHelper.GetBoolean(dataReader, "isClose");

            objItem.Ratting = SqlHelper.GetInt(dataReader, "Ratting");

            objItem.ImgUrl      = SqlHelper.GetString(dataReader, "ImgUrl");
            objItem.SharingType = SqlHelper.GetInt(dataReader, "SharingType");
            objItem.WViews      = SqlHelper.GetInt(dataReader, "WViews");
            return(objItem);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 private static void RemoveCache(DBgl_Workflow objItem)
 {
     dtpCache.RemoveByPattern(SETTINGS_ALL_KEY);
     dtpCache.RemoveByPattern(string.Format(SETTINGS_ID_KEY, objItem.WorkflowID));
     dtpCache.RemoveByPattern(string.Format(SETTINGS_CreatedUser_KEY, objItem.CreatedUser));
 }