Example #1
0
        // this function for just referance for partial update field user have to create seperate function learn from this function.
        public bool UpdatePartial(ENT.Recharge objEntity)
        {
            bool blnResult = false;

            try
            {
                //Create Fields List in dictionary
                Dictionary <string, bool> dctFields = new Dictionary <string, bool>();
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.rechargeid), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.countrycode), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.operatorcode), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.numbertorecharge), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.amount), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.readstatus), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.txid), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.commimd), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.commisd), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.commir), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.commia), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.charge), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.userid), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.beforebalance), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.balance), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.status), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.reqtype), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.reqvia), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.proccessdate), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.rechargemethod), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.routeid), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.webusername), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.requestid), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.accountref), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.optionalparam), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.optionalparam1), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.ipaddress), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.SystemDateTime), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.CreatedBy), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.CreatedDateTime), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.UpdatedBy), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.Recharge>(x => x.UpdatedDateTime), false);
                objEntity.FieldCollection = dctFields;
                if (objDAL.SaveChanges(objEntity.FieldCollection, objEntity))
                {
                    blnResult = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(blnResult);
        }
Example #2
0
        public object GetByPrimaryKey(ENT.Recharge Entity)
        {
            object objResult = null;

            try
            {
                DAL.CRUDOperation tt = new DAL.CRUDOperation();
                objResult = tt.GetEntityByPrimartKey(Entity);
            }
            catch (Exception)
            {
                throw;
            }
            return(objResult);
        }
Example #3
0
 public COM.MEMBERS.SQLReturnMessageNValue DoRecharge(ENT.Recharge obj, Guid userid, string ipaadress)
 {
     return(SqlHelper.ExecuteProceduerWithMessageNValue("ADD_REQUEST_TO_RECHARGE", new object[, ] {
         { "USERID", userid }
         , { "OPERATORCODE", obj.operatorcode.ToString() }
         , { "COUNTRYCODE", obj.countrycode }
         , { "AMTTORECH", obj.amount }
         , { "NUMTORECH", obj.numbertorecharge }
         , { "REQVIA", obj.reqvia }
         , { "RCTYPE", obj.reqtype }
         , { "ACCOUNTREF", obj.accountref }
         , { "IPADDRESS", ipaadress }
         , { "OPTIONALPARAM", obj.optionalparam == null ? string.Empty : obj.optionalparam }
         , { "OPTIONALPARAM1", obj.optionalparam1 == null ? string.Empty : obj.optionalparam1 }
     }, 3));
 }
        public JsonResult doRecharge(ENT.Recharge recharge)
        {
            GlobalVarible.Clear();
            try
            {
                recharge.reqvia      = "WEB";
                recharge.countrycode = "IN";
                recharge.accountref  = DateTime.Now.Ticks.ToString();
                recharge.userid      = _LoginUserId;
                recharge.ipaddress   = Request.UserHostAddress.ToString();

                // this will be provided after recharge

                recharge.requestid = string.Empty;

                COM.MEMBERS.SQLReturnMessageNValue response = new COM.MEMBERS.SQLReturnMessageNValue();

                using (BAL.Recharge objBal = new BAL.Recharge())
                {
                    response = objBal.DoRecharge(recharge, _LoginUserId, recharge.ipaddress);
                }

                string LocalID = string.Empty;

                if (response.Outval == 1)
                {
                    // manage route here to call real api for process recharge.
                    string[] REQ = response.Outmsg.Split(';');

                    // add log or response here.
                    new BAL.Log().Insert(new ENT.Log()
                    {
                        logdata         = REQ[1],
                        CreatedDateTime = DateTime.Now,
                        type            = COM.MyEnumration.LOGTYPE.DATA,
                        title           = "PORTAL-REQUEST"
                    });

                    #region WEBSMITHAPI
                    if (REQ[0].Split(':')[2].StartsWith("W"))
                    {
                        LocalID = REQ[0].Split(':')[2].StartsWith("W") ? REQ[0].Split(':')[2].Remove(0, 1) : REQ[0].Split(':')[2];
                        ProcessRecharge(recharge.numbertorecharge, recharge.operatorcode, (int)recharge.amount, LocalID, recharge.reqtype);
                    }
                    else if (REQ[0].Split(':')[2].StartsWith("X"))
                    {
                        LocalID = REQ[0].Split(':')[2].StartsWith("X") ? REQ[0].Split(':')[2].Remove(0, 2) : REQ[0].Split(':')[2];

                        ProcessINOUT(REQ[1], LocalID);
                    }
                    #endregion

                    GlobalVarible.AddMessage(REQ[0].Split(',')[0]);
                }
                else
                {
                    GlobalVarible.AddError(response.Outmsg);
                }
                return(Json(MySession.Current.MessageResult));
            }
            catch (Exception ex)
            {
                ERRORREPORTING.Report(ex, Request.Url.ToString(), _LoginUserId, _ERRORKEY, new JavaScriptSerializer().Serialize(recharge));
                GlobalVarible.AddError(ex.Message);
                return(Json(MySession.Current.MessageResult));
            }
        }
Example #5
0
        public HttpResponseMessage DoRechargeEnc(doRechargeModel data)
        {
            try
            {
                string token = _LOGINUSERID.ToString();

                if (String.IsNullOrEmpty(token))
                {
                    GlobalVarible.AddError("Unable to get token");
                    ERRORREPORTING.Report(new Exception("UNABLE TO GET TOKEN"), _REQUESTURL, _LOGINUSERID, _ERRORKEY, new JavaScriptSerializer().Serialize(data));
                    return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
                }

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

                ENT.Recharge recharge = new ENT.Recharge();

                recharge = new JavaScriptSerializer().Deserialize <ENT.Recharge>(reqdata);

                try
                {
                    ERRORREPORTING.Report(new Exception("API CALL STARTED"), _REQUESTURL, _LOGINUSERID, _ERRORKEY, reqdata);

                    recharge.reqvia      = "GPRS";
                    recharge.countrycode = "IN";
                    recharge.accountref  = DateTime.Now.Ticks.ToString();
                    recharge.userid      = _LOGINUSERID;
                    recharge.ipaddress   = HttpContext.Current.Request.UserHostAddress;

                    // this will be provided after recharge

                    recharge.requestid = string.Empty;

                    COM.MEMBERS.SQLReturnMessageNValue response = new COM.MEMBERS.SQLReturnMessageNValue();

                    using (BAL.Recharge objBal = new BAL.Recharge())
                    {
                        response = objBal.DoRecharge(recharge, _LOGINUSERID, recharge.ipaddress);
                    }

                    if (response.Outval == 1)
                    {
                        string[] REQ = response.Outmsg.Split(';');

                        // process for real recharge here.

                        GlobalVarible.AddMessage(REQ[0].Split(',')[0]);
                    }
                    else
                    {
                        GlobalVarible.AddError(response.Outmsg);
                    }
                    return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
                }
                catch (Exception ex)
                {
                    ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, new JavaScriptSerializer().Serialize(recharge));
                    GlobalVarible.AddError(ex.Message);
                    return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
                }
            }
            catch (Exception ex)
            {
                ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, new JavaScriptSerializer().Serialize(data));
                GlobalVarible.AddError(ex.Message);
                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
            }
        }