예제 #1
0
        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);
        }
예제 #2
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);
        }