コード例 #1
0
        public ENT.WalletRequest GetRequestById(Guid wr_id)
        {
            ENT.WalletRequest Entity = new ENT.WalletRequest();
            try
            {
                parFields.Clear();

                //Add Query in to string builder object
                QueryDisctionery.SelectPart = "select * ";
                QueryDisctionery.TablePart  = @"from WalletRequest 
                inner join UserDeviceToken on WalletRequest.wr_userid = UserDeviceToken.udt_userid";

                QueryDisctionery.ParameterPart = "where wr_id='" + wr_id + "'";

                //Execute Query and get SQLDataReader
                using (SqlDataReader dr = objDBHelper.ExecuteReaderQuery(QueryDisctionery, parFields, objEntity))
                {
                    Entity = COM.DBHelper.CopyDataReaderToSingleEntity <ENT.WalletRequest>(dr);
                    objDBHelper.Disposed();
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                parFields.Clear();
            }
            return(Entity);
        }
コード例 #2
0
        // this function for just referance for partial update field user have to create seperate function learn from this function.
        public bool UpdatePartial(ENT.WalletRequest objEntity)
        {
            bool blnResult = false;

            try
            {
                //Create Fields List in dictionary
                Dictionary <string, bool> dctFields = new Dictionary <string, bool>();
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.wr_id), true);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.wr_bankname), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.wr_accountno), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.wr_amount), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.wr_refrenceid), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.wr_remakrs), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.wr_status), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.SystemDateTime), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.CreatedBy), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.CreatedDateTime), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.UpdatedBy), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.WalletRequest>(x => x.UpdatedDateTime), false);
                objEntity.FieldCollection = dctFields;
                if (objDAL.SaveChanges(objEntity.FieldCollection, objEntity))
                {
                    blnResult = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(blnResult);
        }
コード例 #3
0
        public object GetByPrimaryKey(ENT.WalletRequest Entity)
        {
            object objResult = null;

            try
            {
                DAL.CRUDOperation tt = new DAL.CRUDOperation();
                objResult = tt.GetEntityByPrimartKey(Entity);
            }
            catch (Exception)
            {
                throw;
            }
            return(objResult);
        }
コード例 #4
0
 public ENT.WalletRequest GetRequestById(Guid wr_id)
 {
     ENT.WalletRequest Entity = new ENT.WalletRequest();
     Entity = clsDAL.GetRequestById(wr_id);
     return(Entity);
 }
コード例 #5
0
        public HttpResponseMessage approveRequest(approveRequest data)
        {
            COM.DBHelper sqlhelper = new COM.DBHelper();
            GlobalVarible.Clear();
            List <string> strvalidationResult = new List <string>();

            try
            {
                string token = _LOGINUSERID.ToString();

                string reqdata = ENCDESC.Decrypt(data.data, token, data.userid);

                MDL.ApproveRequest model = new ApproveRequest();

                model = new JavaScriptSerializer().Deserialize <MDL.ApproveRequest>(reqdata);

                strvalidationResult = ValidateApproveRequest(model);
                if (strvalidationResult.Count() == 0)
                {
                    if (checkpassword(model.loginpassword))
                    {
                        Guid wrid   = new Guid(model.wr_id);
                        Guid userid = Guid.Parse(User.Identity.GetUserId());

                        string[,] param = { { "WR_ID", wrid.ToString() }, { "UPPERID", userid.ToString() } };

                        COM.DBHelper.SQLReturnValue M = sqlhelper.ExecuteProcWithMessageKMT("WALLET_APPROVED", param, true);

                        if (M.ValueFromSQL == 1)
                        {
                            // get detail user device token

                            using (BAL.WalletRequest objUDT = new BAL.WalletRequest())
                            {
                                ENT.WalletRequest request = objUDT.GetRequestById(Guid.Parse(model.wr_id));

                                if (request != null)
                                {
                                    string message = "Your account is credited with with " + request.wr_amount.ToString();
                                    FCMNOTIFICATION.SendPushNotification(request.udt_devicetoken, message, request.wr_userid, 1);
                                }
                            }
                            GlobalVarible.AddMessage(M.MessageFromSQL);
                        }
                        else
                        {
                            throw new Exception(string.Join("<br />", M.MessageFromSQL));
                        }
                    }
                    else
                    {
                        throw new Exception(string.Join("<br />", "Invalid Password !"));
                    }
                }
                else
                {
                    throw new Exception(string.Join("<br />", strvalidationResult));
                }

                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
            }
            catch (Exception ex)
            {
                GlobalVarible.AddError(ex.Message);
                ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty);
                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
            }
        }