Esempio n. 1
0
 public static void Swap_Shopping_Cart(MySqlConnection dbconn,
                                       string pUserId)
 {
     if (HttpContext.Current.Session["SHOPPING_CART_ID"] != null)
     {
         string[] lRecords = CommonClass.FetchRecords("SWAP_SHOPPING_CART",
                                                      new string[]
         {
             "P_EXTERNAL_USER_ID",
             "P_SHOPPING_CART_ID"
         },
                                                      new string[]
         {
             pUserId,
             HttpContext.Current.Session["SHOPPING_CART_ID"].ToString()
         },
                                                      new string[]
         {
             "P_END_SESSION_FLAG"
         },
                                                      dbconn);
         if (lRecords[0] != null && lRecords[0] != "")
         {
             HttpContext.Current.Session.Abandon();
         }
     }
     else
     {
         HttpContext.Current.Session.Abandon();
     }
 }
Esempio n. 2
0
        public static UserModel Get_External_User_Profile(MySqlConnection dbconn)
        {
            UserModel lUserModel = new UserModel();

            if (ClaimsPrincipal.Current.Identity.IsAuthenticated == true)
            {
                MySqlDataReader lMySqlDataReader = CommonClass.FetchRecords("GET_USER_BY_EXTERNAL_ID",
                                                                            new string[] { "P_EXTERNAL_ID" },
                                                                            new string[] { ClaimsPrincipal.Current.FindFirst("user_id").Value },
                                                                            dbconn);
                if (lMySqlDataReader.Read())
                {
                    lUserModel.User_Id          = int.Parse(lMySqlDataReader["USER_ID"].ToString());
                    lUserModel.External_User_Id = lMySqlDataReader["EXTERNAL_USER_ID"].ToString();
                    lUserModel.User_Name        = lMySqlDataReader["USER_NAME"].ToString();
                    if (lMySqlDataReader["MOBILE_NUMBER"] != null)
                    {
                        lUserModel.Mobile_Number = lMySqlDataReader["MOBILE_NUMBER"].ToString();
                    }
                    lUserModel.Mobile_Validated                = int.Parse(lMySqlDataReader["MOBILE_VALIDATED"].ToString());
                    lUserModel.Email_Address                   = lMySqlDataReader["EMAIL_ADDRESS"].ToString();
                    lUserModel.Email_Address_Validated         = int.Parse(lMySqlDataReader["EMAIL_ADDRESS_VALIDATED"].ToString());
                    lUserModel.User_Type_Id                    = int.Parse(lMySqlDataReader["USER_TYPE_ID"].ToString());
                    lUserModel.Email_Address_Validated_Message = lMySqlDataReader["EMAIL_ADDRESS_VALIDATED_MESSAGE"].ToString();
                    lUserModel.Mobile_Delivery_Option          = int.Parse(lMySqlDataReader["MOBILE_DELIVERY_OPTION"].ToString());
                    lUserModel.Email_Delivery_Option           = int.Parse(lMySqlDataReader["EMAIL_DELIVERY_OPTION"].ToString());
                }
                lMySqlDataReader.Close();
            }
            return(lUserModel);
        }
Esempio n. 3
0
        public static string[] Get_Address_By_Id(string lAddressId)
        {
            MySqlConnection dbconn = new MySqlConnection(connectionstring);

            dbconn.Open();
            MySqlDataReader lMySqlDataReader = CommonClass.FetchRecords("GET_ADDRESS_BY_ID",
                                                                        new string[]
            {
                "P_ADDRESS_ID"
            },
                                                                        new string[]
            {
                lAddressId
            },
                                                                        dbconn);

            string[] lAddress = null;
            if (lMySqlDataReader.Read())
            {
                lAddress = new string[] {
                    lMySqlDataReader["USER_NAME"].ToString(),
                    lMySqlDataReader["MOBILE_NUMBER"].ToString(),
                    lMySqlDataReader["SHIPPING_ADDRESS"].ToString(),
                    lMySqlDataReader["CITY_NAME"].ToString(),
                    lMySqlDataReader["STATE_NAME"].ToString(),
                    lMySqlDataReader["PIN_CODE"].ToString()
                };
            }
            lMySqlDataReader.Close();
            dbconn.Close();
            return(lAddress);
        }
Esempio n. 4
0
        public static UserAddress Get_User_Address(string p_AddressId,
                                                   MySqlConnection dbconn)
        {
            UserAddress     lUserAddress     = new UserAddress();
            MySqlDataReader lMySqlDataReader = CommonClass.FetchRecords("GET_ADDRESS_BY_ID",
                                                                        new string[]
            {
                "P_ADDRESS_ID"
            },
                                                                        new string[]
            {
                p_AddressId
            },
                                                                        dbconn);

            if (lMySqlDataReader.Read())
            {
                lUserAddress.User_Name     = lMySqlDataReader["USER_NAME"].ToString();
                lUserAddress.Mobile_Number = lMySqlDataReader["MOBILE_NUMBER"].ToString();
                lUserAddress.Address       = lMySqlDataReader["SHIPPING_ADDRESS"].ToString();
                lUserAddress.City          = lMySqlDataReader["CITY_NAME"].ToString();
                lUserAddress.State         = lMySqlDataReader["STATE_NAME"].ToString();
                lUserAddress.Pin_Code      = lMySqlDataReader["PIN_CODE"].ToString();
            }
            lMySqlDataReader.Close();
            return(lUserAddress);
        }
Esempio n. 5
0
        public static List <PolicyModel> Get_All_Policies()
        {
            List <PolicyModel> lPolicies = new List <PolicyModel>();
            MySqlConnection    dbconn    = new MySqlConnection(CommonClass.connectionstring);
            MySqlConnection    dbconn1   = new MySqlConnection(CommonClass.connectionstring);
            MySqlConnection    dbconn2   = new MySqlConnection(CommonClass.connectionstring);

            dbconn.Open();
            MySqlDataReader reader = CommonClass.FetchRecords("GET_ALL_POLICIES",
                                                              new string[] { },
                                                              new string[] { },
                                                              dbconn);

            while (reader.Read())
            {
                PolicyModel lPolicy = new PolicyModel();
                lPolicy.Policy_Id           = int.Parse(reader["POLICY_ID"].ToString());
                lPolicy.Policy_Name         = reader["POLICY_NAME"].ToString();
                lPolicy.Policy_Updated_Date = reader["LAST_UPDATED_DATE"].ToString();
                dbconn1.Open();
                MySqlDataReader reader1 = CommonClass.FetchRecords("GET_POLICY_HEADERS",
                                                                   new string[] { "P_POLICY_ID" },
                                                                   new string[] { reader["POLICY_ID"].ToString() },
                                                                   dbconn1);
                List <Policy_Details> lPolicyDetails = new List <Policy_Details>();
                while (reader1.Read())
                {
                    Policy_Details lPolicyDetail = new Policy_Details();
                    lPolicyDetail.Policy_Header_Text = reader1["HEADER_TEXT"].ToString();
                    List <Policy_Contents> lPolicyContents = new List <Policy_Contents>();
                    dbconn2.Open();
                    MySqlDataReader reader2 = CommonClass.FetchRecords("GET_POLICY_CONTENT",
                                                                       new string[] { "P_POLICY_ID", "P_POLICY_HEADER_ID" },
                                                                       new string[] { reader["POLICY_ID"].ToString(), reader1["POLICY_HEADER_ID"].ToString() },
                                                                       dbconn2);
                    while (reader2.Read())
                    {
                        Policy_Contents lPolicyContent = new Policy_Contents();
                        lPolicyContent.Policy_Content = reader2["CONTENT"].ToString();
                        lPolicyContents.Add(lPolicyContent);
                    }
                    lPolicyDetail.Policy_Contents = lPolicyContents;
                    reader2.Close();
                    dbconn2.Close();
                    lPolicyDetails.Add(lPolicyDetail);
                }
                lPolicy.Policy_Details = lPolicyDetails;
                reader1.Close();
                dbconn1.Close();
                lPolicies.Add(lPolicy);
            }
            reader.Close();
            dbconn.Close();
            return(lPolicies);
        }
Esempio n. 6
0
        public static void Generate_OTP(string pMobileNumber,
                                        string pUserName,
                                        Label pLabel,
                                        PlaceHolder pPlaceHolder,
                                        MySqlConnection dbconn)
        {
            MySqlTransaction Transaction = dbconn.BeginTransaction();

            //Repeater lMobileNumberRepeater = User_FormView.FindControl("Mobile_Number_Repeater") as Repeater;
            //Label lOTPMessageLabel = User_FormView.FindControl("OTP_Message") as Label;
            //string lOTPMessageLabel;
            //lOTPMessageLabel.Visible = true;
            try
            {
                string   lMobileNumber = HttpContext.Current.Server.HtmlEncode(pMobileNumber);
                string   lUserName     = HttpContext.Current.Server.HtmlEncode(pUserName);
                string[] lRecords      = CommonClass.FetchRecords("GENERATE_MOBILE_ACTIVATION_CODE",
                                                                  new string[]
                {
                    "P_USER_ID",
                    "P_MOBILE_NUMBER"
                },
                                                                  new string[]
                {
                    ClaimsPrincipal.Current.FindFirst("user_id").Value,
                    lMobileNumber
                },
                                                                  new string[]
                {
                    "P_ACTIVATION_CODE"
                },
                                                                  dbconn);

                if (lRecords[0] != null)
                {
                    Messages.Send_Mobile_Validate_Message(lMobileNumber, lUserName, lRecords[0], dbconn);
                    pPlaceHolder.Visible = true;
                    pLabel.Text          = "OTP Successfully Generated";
                    pLabel.ForeColor     = Color.Green;
                }
                else
                {
                    pLabel.ForeColor = Color.Red;
                    pLabel.Text      = "Unable to Generate OTP";
                }
                Transaction.Commit();
            }
            catch
            {
                Transaction.Rollback();
                pLabel.Text      = "Server Error, Try after sometime";
                pLabel.ForeColor = Color.Red;
            }
        }
Esempio n. 7
0
        public static string Refund_Order(MySqlConnection dbconn,
                                          string pOrderId,
                                          string pOrderNumber,
                                          string pCustomerId,
                                          string pRefundAmount,
                                          string pOriginalTransactionId,
                                          string pCancellationReason)
        {
            string lErrorMessage = null;

            string[] lRecords = CommonClass.FetchRecords("ADD_REFUND",
                                                         new string[]
            {
                "P_ORDER_ID",
                "P_REFUND_AMOUNT",
                "P_EXTERNAL_USER_ID"
            },
                                                         new string[]
            {
                pOrderId,
                pRefundAmount,
                ClaimsPrincipal.Current.FindFirst("user_id").Value
            },
                                                         new string[]
            {
                "P_ERROR_STRING",
                "P_REFUND_ID"
            },
                                                         dbconn);

            if (lRecords[0] != null && lRecords[0] != "") // some error happened
            {
                lErrorMessage = lRecords[0];
            }
            else
            {
                Messages.Send_Refund_Request_Message(pOrderNumber,
                                                     pRefundAmount,
                                                     pCustomerId,
                                                     dbconn);
                Refund_PayTm_Order(pOrderId,
                                   pOriginalTransactionId,
                                   pRefundAmount,
                                   pCancellationReason,
                                   lRecords[1]);
            }
            return(lErrorMessage);
        }
Esempio n. 8
0
        public static string Reject_Refund_Order(MySqlConnection dbconn,
                                                 string pOrderId,
                                                 string pOrderNumber,
                                                 string pRejectionReasonId,
                                                 string pRejectionReason,
                                                 string pCustomerId,
                                                 string pRejectionReasonDisplay)
        {
            string lErrorMessage = null;

            string[] lRecords = CommonClass.FetchRecords("REJECT_REUND",
                                                         new string[]
            {
                "P_CUSTOMER_ID",
                "P_EXTERNAL_USER_ID",
                "P_ORDER_ID",
                "P_REJECTION_REASON_ID",
                "P_REJECTION_REASON"
            },
                                                         new string[]
            {
                pCustomerId,
                ClaimsPrincipal.Current.FindFirst("user_id").Value,
                pOrderId,
                pRejectionReasonId,
                pRejectionReason
            },
                                                         new string[]
            {
                "P_ERROR_STRING"
            },
                                                         dbconn
                                                         );

            if (lRecords[0] != null && lRecords[0] != "")
            {
                lErrorMessage = lRecords[0];
            }
            else
            {
                Messages.Send_Reject_Refund_Request_Message(pOrderNumber,
                                                            pRejectionReasonDisplay,
                                                            pCustomerId,
                                                            dbconn);
            }
            return(lErrorMessage);
        }
Esempio n. 9
0
        public static string Undeliver_Order(MySqlConnection dbconn,
                                             string pOrderId,
                                             string pOrderNumber,
                                             string pCustomerId,
                                             string pUnDeliveredReasonId,
                                             string pUnDeliveredReason,
                                             string pUnDeliveredReasonDisplay)
        {
            string lErrorMessage = null;

            string[] lRecords = CommonClass.FetchRecords("ADD_DELIVERY_RETURN",
                                                         new string[]
            {
                "P_CUSTOMER_ID",
                "P_EXTERNAL_USER_ID",
                "P_ORDER_ID",
                "P_UNDELIVERED_REASON_ID",
                "P_UNDELIVERED_REASON"
            },
                                                         new string[]
            {
                pCustomerId,
                ClaimsPrincipal.Current.FindFirst("user_id").Value,
                pOrderId,
                pUnDeliveredReasonId,
                HttpContext.Current.Server.HtmlEncode(pUnDeliveredReason),
            },
                                                         new string[]
            {
                "P_ERROR_STRING"
            },
                                                         dbconn);

            if (lRecords[0] != null && lRecords[0] != "")
            {
                lErrorMessage = lRecords[0];
            }
            else
            {
                Messages.Send_Order_Undelivered_Message(pOrderNumber,
                                                        pUnDeliveredReasonDisplay,
                                                        pCustomerId,
                                                        dbconn);
            }
            return(lErrorMessage);
        }
Esempio n. 10
0
        public static void Validate_Mobile(string pMobileNumber,
                                           string pMobileOTP,
                                           Label pLabel,
                                           PlaceHolder pPlaceHolder,
                                           MySqlConnection dbconn
                                           )
        {
            //TextBox lMobile_Number_TextBox = User_FormView.FindControl("Mobile_Number") as TextBox;
            // Repeater lMobile_Number_Repeater = User_FormView.FindControl("Mobile_Number_Repeater") as Repeater;
            //RepeaterItem lRepeaterItem1 = lMobile_Number_Repeater.Items[0];
            string[] lRecords = CommonClass.FetchRecords("VALIDATE_MOBILE",
                                                         new string[]
            {
                "P_USER_ID",
                "P_MOBILE_NUMBER",
                "P_VALIDATION_CODE"
            },
                                                         new string[]
            {
                ClaimsPrincipal.Current.FindFirst("user_id").Value,
                pMobileNumber,
                pMobileOTP
            },
                                                         new string[]
            {
                "P_STATUS"
            },
                                                         dbconn);

            // Bind_Contacts("1", dbconn, lMobile_Number_Repeater);


            //Label OTP_Message_Label = User_FormView.FindControl("OTP_Message") as Label;
            pLabel.Visible = true;
            if (lRecords[0] != null)
            {
                pLabel.Text      = lRecords[0];
                pLabel.ForeColor = Color.Red;
            }
            else
            {
                pPlaceHolder.Visible = false;
                pLabel.Text          = "OTP Successfully Validated";
                pLabel.ForeColor     = Color.Green;
            }
        }
Esempio n. 11
0
        public static string Add_Delivery_Information(MySqlConnection dbconn,
                                                      string pOrderId,
                                                      string pOrderNumber,
                                                      string pCustomerId,
                                                      string pOrderAmount,
                                                      string pDeliveryDate,
                                                      string pPaymentRef)
        {
            PaymentClass.CCAvenue_Confirm_Order(pPaymentRef, pOrderAmount);
            string lErrorMessage = null;

            string[] lRecords = CommonClass.FetchRecords("ADD_DELIVERY_INFO",
                                                         new string[]
            {
                "P_ORDER_ID",
                "P_CUSTOMER_ID",
                "P_EXTERNAL_USER_ID",
                "P_DELIVERY_DATE"
            },
                                                         new string[]
            {
                pOrderId,
                pCustomerId,
                ClaimsPrincipal.Current.FindFirst("user_id").Value,
                pDeliveryDate
            },
                                                         new string[]
            {
                "P_ERROR_STRING"
            },
                                                         dbconn
                                                         );
            if (lRecords[0] != null && lRecords[0] != "")
            {
                lErrorMessage = lRecords[0];
            }
            else
            {
                Messages.Send_Order_Delivered_Message(pOrderNumber,
                                                      pCustomerId,
                                                      pDeliveryDate,
                                                      dbconn);
            }
            return(lErrorMessage);
        }
Esempio n. 12
0
        public static string Cancel_Order(MySqlConnection dbconn,
                                          string pOrderId,
                                          string pOrderNumber,
                                          string pCustomerId,
                                          string pCancellationReasonId,
                                          string pCancellationReason,
                                          string pCancellationReasonDisplay)
        {
            string lErrorMessage = null;

            string[] lRecords = CommonClass.FetchRecords("CANCEL_ORDER",
                                                         new string[]
            {
                "P_CUSTOMER_ID",
                "P_EXTERNAL_USER_ID",
                "P_ORDER_ID",
                "P_CANCELLATION_REASON_ID",
                "P_CANCELLATION_REASON"
            },
                                                         new string[]
            {
                pCustomerId,
                ClaimsPrincipal.Current.FindFirst("user_id").Value,
                pOrderId,
                pCancellationReasonId,
                HttpContext.Current.Server.HtmlEncode(pCancellationReason),
            },
                                                         new string[]
            {
                "P_ERROR_STRING"
            },
                                                         dbconn);

            if (lRecords[0] != null && lRecords[0] != "")
            {
                lErrorMessage = lRecords[0];
            }
            else
            {
                Messages.Send_Order_Cancellation_Request_Message(pOrderNumber,
                                                                 pCustomerId,
                                                                 dbconn);
            }
            return(lErrorMessage);
        }
Esempio n. 13
0
        public static List <ProductModel> Get_Active_Products()
        {
            List <ProductModel> Products = new List <ProductModel>();
            MySqlConnection     dbconn   = new MySqlConnection(CommonClass.connectionstring);
            MySqlConnection     dbconn1  = new MySqlConnection(CommonClass.connectionstring);

            dbconn.Open();
            MySqlDataReader reader = CommonClass.FetchRecords("GET_ACIVE_PRODUCTS",
                                                              new string[] { "PHOTO_IND" },
                                                              new string[] { "0" },
                                                              dbconn);

            while (reader.Read())
            {
                ProductModel product = new ProductModel();
                product.id      = int.Parse(reader["PRODUCT_ID"].ToString());
                product.Name    = reader["PRODUCT_NAME"].ToString();
                product.Picture = "http://www.gilldstore.in/img/" + reader["PHOTO_FILE_NAME"].ToString();
                List <Product_Price> ProductPrices = new List <Product_Price>();
                dbconn1.Open();
                MySqlDataReader reader1 = CommonClass.FetchRecords("GET_PRODUCT_PRICE",
                                                                   new string[] { "P_PRODUCT_ID", "P_CUSTOMER_ID", "P_EXTERNAL_USER_ID" },
                                                                   new string[] { reader["PRODUCT_ID"].ToString(), null, null },
                                                                   dbconn1);
                while (reader1.Read())
                {
                    Product_Price productprice = new Product_Price();
                    productprice.Measurement_Name   = reader1["MEASUREMENT_NAME"].ToString();
                    productprice.Measurement_Unit   = double.Parse(reader1["MEASUREMENT_UNIT"].ToString());
                    productprice.Price              = double.Parse(reader1["PRICE"].ToString());
                    productprice.ShippingCharge     = double.Parse(reader1["SHIPPING_CHARGE"].ToString());
                    productprice.DisplayMeasurement = reader1["MEASUREMENT_UNIT"].ToString() + " " + reader1["MEASUREMENT_NAME"].ToString();
                    ProductPrices.Add(productprice);
                }
                reader1.Close();
                dbconn1.Close();
                product.Productrices = ProductPrices;
                Products.Add(product);
            }
            dbconn.Close();
            return(Products);
        }
Esempio n. 14
0
 public static void Create_Cash_Payment(MySqlConnection dbconn,
                                        string lOrderAmount,
                                        string lCustomerId)
 {
     string[] lPaymentRecords = CommonClass.FetchRecords("ADD_CASH_PAYMENT",
                                                         new string[]
     {
         "P_PAYMENT_AMOUNT",
         "P_EXTERNAL_USER_ID",
         "P_CUSTOMER_ID",
     },
                                                         new string[]
     {
         lOrderAmount,
         ClaimsPrincipal.Current.FindFirst("user_id").Value,
         lCustomerId
     },
                                                         new string[]
     {
         "P_ERROR_STRING"
     },
                                                         dbconn);
     Allocate_Order(dbconn, lCustomerId);
 }
Esempio n. 15
0
        public static void Confirm_Order(MySqlConnection dbconn,
                                         string lOrderId)
        {
            MySqlDataReader lMySqlDataReader = CommonClass.FetchRecords("GET_ORDER_BY_ID",
                                                                        new string[]
            {
                "P_ORDER_ID",
                "P_EXTERNAL_USER_ID"
            },
                                                                        new string[]
            {
                lOrderId,
                ClaimsPrincipal.Current.FindFirst("user_id").Value
            },
                                                                        dbconn
                                                                        );
            string lAddress         = "";
            string lOrderDate       = "";
            string lOrderAmount     = "";
            string lSubtotal        = "";
            string lShippingCharges = "";
            string lDiscount        = "";
            string lGrandTotal      = "";
            string lOrderNumber     = "";
            string lPaymentType     = "";
            string lUserId          = null;
            string lDeliveryMethod  = null;

            string[] lCodEligible      = null;
            string   lPinCode          = null;
            string   lPromotionApplied = "N";

            if (lMySqlDataReader.Read())
            {
                lOrderNumber = lMySqlDataReader["ORDER_NUMBER"].ToString();
                if (lMySqlDataReader["ADDRESS_ID"] != null)
                {
                    string[] lAddressArray = CommonClass.Get_Address_By_Id(lMySqlDataReader["ADDRESS_ID"].ToString());
                    lAddress = CommonClass.Format_Address(lAddressArray[0], lAddressArray[1], lAddressArray[2], lAddressArray[3], lAddressArray[4], lAddressArray[5]);
                    lPinCode = lAddressArray[5];
                }
                lOrderDate        = lMySqlDataReader["ORDER_DATE"].ToString();
                lOrderAmount      = lMySqlDataReader["ORDER_TOTAL"].ToString();
                lShippingCharges  = lMySqlDataReader["SHIPPING_CHARGE"].ToString();
                lDiscount         = lMySqlDataReader["DISCOUNTS"].ToString();
                lSubtotal         = (double.Parse(lOrderAmount) - double.Parse(lShippingCharges) + double.Parse(lDiscount)).ToString();
                lPaymentType      = lMySqlDataReader["PAYMENT_TYPE"].ToString();
                lGrandTotal       = lOrderAmount;
                lUserId           = lMySqlDataReader["USER_ID"].ToString();
                lDeliveryMethod   = lMySqlDataReader["DELIVERY_METHOD_ID"].ToString();
                lPromotionApplied = lMySqlDataReader["PROMOTION_APPLIED"].ToString();
            }

            lMySqlDataReader.Close();


            if (lPinCode != null && lPromotionApplied == "N")
            {
                lCodEligible = CommonClass.FetchRecords("IS_COD",
                                                        new string[]
                {
                    "P_PIN_CODE"
                },
                                                        new string[]
                {
                    lPinCode
                },
                                                        new string[]
                {
                    "P_ELIGIBLE"
                },
                                                        dbconn);
            }

            PaymentClass.Allocate_Order(dbconn, lUserId);

            UserDetails lUserDetails = Messages.Get_Contact_Details(lUserId, dbconn);

            lMySqlDataReader = CommonClass.FetchRecords("GET_ORDER_DETAILS_BY_ID",
                                                        new string[]
            {
                "P_ORDER_ID",
                "P_EXTERNAL_ID"
            },
                                                        new string[]
            {
                lOrderId,
                ClaimsPrincipal.Current.FindFirst("user_id").Value
            },
                                                        dbconn);
            string lOrderSummary = "";

            while (lMySqlDataReader.Read())
            {
                lOrderSummary += "<tr>";
                lOrderSummary += "<td>" + lMySqlDataReader["PRODUCT_NAME"].ToString() + " </td>";
                lOrderSummary += "<td>" + lMySqlDataReader["MEASUREMENT_UNIT"].ToString() + " </td>";
                lOrderSummary += "<td>" + lMySqlDataReader["QUANTITY"].ToString() + " </td>";
                lOrderSummary += "<td>₹ " + lMySqlDataReader["PRICE"].ToString() + " </td>";
                lOrderSummary += "<td>₹ " + lMySqlDataReader["SUBTOTAL"].ToString() + " </td>";
                lOrderSummary += "</tr>";
            }
            lMySqlDataReader.Close();

            Messages.Send_Order_Confirmation_Message(lUserDetails.Email,
                                                     lUserDetails.User_Name,
                                                     lAddress,
                                                     lUserDetails.Mobile_Number,
                                                     lOrderNumber,
                                                     lOrderDate,
                                                     lOrderAmount,
                                                     lOrderSummary,
                                                     lSubtotal,
                                                     lShippingCharges,
                                                     lGrandTotal,
                                                     lDiscount,
                                                     lPaymentType,
                                                     dbconn);


            if (lDeliveryMethod == "3" && lCodEligible[0] != "1")
            {
                Messages.Send_Order_Confirmation_Message_To_Seller(
                    lAddress,
                    lOrderNumber,
                    lOrderDate,
                    lOrderAmount,
                    lOrderSummary,
                    lSubtotal,
                    lShippingCharges,
                    lGrandTotal,
                    lDiscount,
                    lPaymentType,
                    dbconn);
            }
        }
Esempio n. 16
0
        public static void Allocate_Order(
            MySqlConnection dbconn,
            string p_UserId)
        {
            MySqlConnection dbconn1 = new MySqlConnection(CommonClass.connectionstring);
            MySqlConnection dbconn2 = new MySqlConnection(CommonClass.connectionstring);

            dbconn1.Open();
            dbconn2.Open();
            MySqlDataReader lMySqlDataReader1 = CommonClass.FetchRecords("GET_UNALLOCATED_PAYMENT_BY_USER_ID",
                                                                         new string[]
            {
                "P_USER_ID"
            },
                                                                         new string[]
            {
                p_UserId
            },
                                                                         dbconn1);

            MySqlDataReader lMySqlDataReader = CommonClass.FetchRecords("GET_DUE_ORDER_LIST_BY_USER_ID",
                                                                        new string[]
            {
                "P_USER_ID"
            },
                                                                        new string[]
            {
                p_UserId
            },
                                                                        dbconn);
            double lUnallocated_Amount = 0;
            string lPaymentId          = null;

            while (lMySqlDataReader.Read())
            {
                string lOrderId  = lMySqlDataReader["ORDER_ID"].ToString();
                double lOrderDue = double.Parse(lMySqlDataReader["ORDER_DUE"].ToString());
                while (lOrderDue != 0)
                {
                    double lAllocatedAmount = 0;
                    if (lUnallocated_Amount == 0)
                    {
                        if (lMySqlDataReader1.Read())
                        {
                            lUnallocated_Amount = double.Parse(lMySqlDataReader1["UNALLOCATED_AMOUNT"].ToString());
                            lPaymentId          = lMySqlDataReader1["PAYMENT_ID"].ToString();
                        }
                        else
                        {
                            break;
                        }
                    }

                    if (lOrderDue >= lUnallocated_Amount)
                    {
                        lAllocatedAmount    = lUnallocated_Amount;
                        lOrderDue          -= lUnallocated_Amount;
                        lUnallocated_Amount = 0;
                    }
                    else
                    {
                        lUnallocated_Amount -= lOrderDue;
                        lAllocatedAmount     = lOrderDue;
                        lOrderDue            = 0;
                    }

                    CommonClass.ExecuteQuery("ADD_PAYMENT_ORDER",
                                             new string[]
                    {
                        "P_PAYMENT_ID",
                        "P_ORDER_ID",
                        "P_AMOUNT"
                    },
                                             new string[]
                    {
                        lPaymentId,
                        lOrderId,
                        lAllocatedAmount.ToString()
                    },
                                             dbconn2);
                }
            }
            lMySqlDataReader.Close();
            lMySqlDataReader1.Close();
            dbconn1.Close();
            dbconn2.Close();
        }
Esempio n. 17
0
        public static void Create_Shopping_Cart(MySqlConnection dbconn)
        {
            if (HttpContext.Current.Session["SHOPPING_CART_ID"] == null)
            {
                string lUserId = null;
                if (ClaimsPrincipal.Current.Identity.IsAuthenticated == true)
                {
                    lUserId = ClaimsPrincipal.Current.FindFirst("user_id").Value;
                }

                Random   rand = new Random();
                string   lSurprise_Discount_Percentage = rand.Next(1, 3).ToString();
                int      lNoOfShippingItems            = 0;
                double   lShippingValue = 0.0;
                string[] lRecords       = CommonClass.FetchRecords("CREATE_SHOPPING_CART",
                                                                   new string[]
                {
                    "P_EXTERNAL_USER_ID",
                    "P_SESSION_ID",
                    "P_SURPRISE_DISCOUNT_PERCENTAGE"
                },
                                                                   new string[]
                {
                    lUserId,
                    HttpContext.Current.Session.SessionID,
                    lSurprise_Discount_Percentage
                },
                                                                   new string[]
                {
                    "P_SHIPPING_CART_ID",
                    "P_NO_OF_ITEMS",
                    "P_ITEM_VALUE"
                },
                                                                   dbconn);
                MySqlDataReader lMySqlDataReader = CommonClass.FetchRecords("GET_SHOPPING_CART",
                                                                            new string[]
                {
                    "P_SHOPPING_CART_ID"
                },
                                                                            new string[]
                {
                    lRecords[0]
                },
                                                                            dbconn);
                if (lMySqlDataReader.Read())
                {
                    HttpContext.Current.Session["SHIPPING_STATE"] = lMySqlDataReader["STATE_ID"].ToString();
                    HttpContext.Current.Session["SURPRISE_DISCOUNT_PERCENTAGE"] = lMySqlDataReader["SURPRISE_DISCOUNT_PERCENTAGE"].ToString();
                    HttpContext.Current.Session["PROMOTION_CODE"]      = lMySqlDataReader["PROMOTION_CODE"].ToString();
                    HttpContext.Current.Session["DELIVERY_ADDRESS_ID"] = lMySqlDataReader["DELIVERY_ADDRESS_ID"].ToString();
                }
                else
                {
                    HttpContext.Current.Session["SURPRISE_DISCOUNT_PERCENTAGE"] = lSurprise_Discount_Percentage;
                }

                if (lRecords[1] != "" && lRecords[1] != null)
                {
                    lNoOfShippingItems = int.Parse(lRecords[1]);
                    lShippingValue     = double.Parse(lRecords[2]);
                }
                HttpContext.Current.Session["SHOPPING_ITEMS"]       = lNoOfShippingItems;
                HttpContext.Current.Session["SHOPPING_ITEMS_VALUE"] = lShippingValue;
                HttpContext.Current.Session["SHOPPING_CART_ID"]     = lRecords[0];
                lMySqlDataReader.Close();
            }
        }