Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblProfileName.Text = " Wellcome," + " " + USERPROFILEMASTER.GetByUser_Name(Session["UserName"] == null ? string.Empty : Session["UserName"].ToString()).First_Name + " " + USERPROFILEMASTER.GetByUser_Name(Session["UserName"] == null ? string.Empty : Session["UserName"].ToString()).Last_Name;
            decimal Am = USERPROFILEMASTER.GetByRegistration_ID(int.Parse(Session["loginid"].ToString())).UserWallet;

            lblWallet.Text = Am.ToString();
        }
Пример #2
0
 public string SaveUser(SaveUserClass user)
 {
     try
     {
         string constr = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
         using (SqlConnection conn = new SqlConnection(constr))
         {
             USERPROFILEMASTER rm = new USERPROFILEMASTER();
             rm.Registration_ID = USERPROFILEMASTER.MaxId() + 1;
             rm.First_Name      = user.Fname;
             rm.Last_Name       = user.Lname;
             rm.Email           = user.Email;
             rm.User_Name       = user.UserName;
             rm.User_ID         = "OM000000" + rm.Registration_ID;
             rm.Password        = user.Password;
             rm.DOB             = DateTime.Today;
             rm.ContactNumber   = user.ContactNo;
             rm.NomineeName     = "";
             rm.NomineeId       = "";
             rm.NomineeRelation = "";
             USERPROFILEMASTER um1 = USERPROFILEMASTER.GetByUser_Name(user.RefId);
             if (string.IsNullOrWhiteSpace(um1.Reference_Id))
             {
                 return("Reference Id is not available");
             }
             rm.Reference_Id         = user.RefId;
             rm.RegDate              = DateTime.Today.Date;
             rm.COUNTRY              = "India";
             rm.Individual_Company   = ""; rm.IdentificationType = ""; rm.TaxExempt = ""; rm.Commission = ""; rm.WFile = "";
             rm.AnniversaryDate      = DateTime.Today; rm.SmartDeliveryDate = DateTime.Today;
             rm.Website              = ""; rm.Address = ""; rm.AddressLine2 = ""; rm.City = 1; rm.State = 1; rm.StateOther = "";
             rm.ZipCode              = ""; rm.ShippingFirstName = ""; rm.ShippingLastName = ""; rm.ShippingAddress = "";
             rm.ShippingAddressLine2 = ""; rm.ShippingCity = 1; rm.ShippingState = 1; rm.ShippingZip = ""; rm.ShippingStateOther = "";
             rm.AlternativeNumber    = ""; rm.Fax = ""; rm.Co_Applicant = ""; rm.Language = ""; rm.Skype = ""; rm.Twitter = ""; rm.Facebook = ""; rm.AadharVerified = "";
             rm.AadharImage          = ""; rm.PanVerified = ""; rm.PanImage = ""; rm.ChequeVerified = ""; rm.ChequeImage = ""; rm.GstinVerified = "";
             rm.AddressVerified      = ""; rm.AddressImage = ""; rm.Image_Name = ""; rm.Status = "Active"; rm.BankName = ""; rm.AccountNo = "";
             rm.IFSCCode             = ""; rm.Branch = ""; rm.UserParentId = 0;
             rm.Save();
             // Sendmsg("Welcome to OMHRD " + " ", user.ContactNo.Trim());
         }
         return(string.Empty);
     }
     catch (Exception ex)
     {
         return("Username is not available");
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["loginid"] != null && !string.IsNullOrEmpty(Session["loginid"].ToString()))
         {
             myAccount.Visible = true;
         }
         else
         {
             myAccount.Visible = false;
         }
         loggedinUserId.Value = Session["loginid"] == null ? string.Empty : Session["loginid"].ToString();
         FIllAllProduct();
         lblProfileName.Text = " Hello," + USERPROFILEMASTER.GetByUser_Name(Session["UserName"] == null ? string.Empty : Session["UserName"].ToString()).User_Name;
     }
 }
 protected void btnPayment_Click(object sender, EventArgs e)
 {
     try
     {
         PaymentMaster um = new PaymentMaster();
         if (btnPayment.Text == "Submit")
         {
             um.Paymemt_ID = PaymentMaster.GetMaxID() + 1;
             um.User_Name  = ddlUserName.SelectedItem.Text;
             um.User_ID    = USERPROFILEMASTER.GetByUser_Name(um.User_Name).User_Name;// lblUSerId.Text.Trim();
             um.Amount     = decimal.Parse(txtamount.Text);
             um.Remark     = txtremark.Text.Trim();
             um.Save();
             grid();
             ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Submit Successfully....');</Script>", false);
         }
         else if (btnPayment.Text == "Update")
         {
             um            = PaymentMaster.GetByPaymemt_ID(int.Parse(ViewState["id"].ToString()));
             um.Paymemt_ID = int.Parse(ViewState["id"].ToString());
             um.User_Name  = ddlUserName.SelectedItem.Text;
             um.User_ID    = USERPROFILEMASTER.GetByUser_Name(um.User_Name).User_Name;// lblUSerId.Text.Trim();
             um.Amount     = decimal.Parse(txtamount.Text);
             um.Remark     = txtremark.Text.Trim();
             um.Save();
             btnPayment.Text = "Submit";
             grid();
             ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Update Successfully..');</Script>", false);
         }
         ClearInputs(Page.Controls);
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert(error);</script>", false);
     }
 }
Пример #5
0
        public void PrintBill()
        {
            try
            {
                int UserId = 0;
                Int32.TryParse(ddlUser.SelectedValue, out UserId);
                List <ProductInvoice_Master> _Pro = ProductInvoice_MasterCollection.GetAll().FindAll(x => x.BILL_ID == billid);
                #region Company
                string CompanyName    = USERPROFILEMASTER.GetByUser_Name("OMHRD").First_Name;
                string CompanyAddress = USERPROFILEMASTER.GetByUser_Name("OMHRD").Address;
                string CompanyState   = USERPROFILEMASTER.GetByUser_Name("OMHRD").StateName;
                string CompanyCity    = USERPROFILEMASTER.GetByUser_Name("OMHRD").CityName;
                string ZipCode        = USERPROFILEMASTER.GetByUser_Name("OMHRD").ZipCode;
                string CompanyGST     = USERPROFILEMASTER.GetByUser_Name("OMHRD").GstinVerified;
                string CompanyContact = USERPROFILEMASTER.GetByUser_Name("OMHRD").ContactNumber;
                #endregion
                #region Seller
                string ShipName  = USERPROFILEMASTER.GetByRegistration_ID(UserId).First_Name + " " + USERPROFILEMASTER.GetByRegistration_ID(UserId).Last_Name;
                string ShipAdd1  = USERPROFILEMASTER.GetByRegistration_ID(UserId).Address;
                string ShipAdd2  = USERPROFILEMASTER.GetByRegistration_ID(UserId).AddressLine2;
                string ShipState = USERPROFILEMASTER.GetByRegistration_ID(UserId).StateName;
                string ShipCity  = USERPROFILEMASTER.GetByRegistration_ID(UserId).CityName;
                string ShipZip   = USERPROFILEMASTER.GetByRegistration_ID(UserId).ZipCode;
                string Contry    = USERPROFILEMASTER.GetByRegistration_ID(UserId).COUNTRY;

                string BillName       = USERPROFILEMASTER.GetByRegistration_ID(UserId).First_Name + " " + USERPROFILEMASTER.GetByRegistration_ID(UserId).Last_Name;
                string PermanentAdd1  = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingAddress;
                string PermanentAdd2  = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingAddressLine2;
                string PermanentState = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippStateName;
                string PermanentCity  = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShipCityName;
                string PermanentZip   = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingZip;
                string Gstin          = USERPROFILEMASTER.GetByRegistration_ID(UserId).GstinVerified;
                #endregion
                #region PickUp
                int    PicupId       = int.Parse(Session["PickupID"].ToString());
                string PickUpName    = PickupMaster.GetByPickupID(PicupId).FirstName + " " + PickupMaster.GetByPickupID(PicupId).LastName;
                string PickUpAddress = PickupMaster.GetByPickupID(PicupId).Address;
                string PickUpContact = PickupMaster.GetByPickupID(PicupId).ContactNo;
                string CenterName    = PickupMaster.GetByPickupID(PicupId).CenterName;
                string CenterCode    = PickupMaster.GetByPickupID(PicupId).CenterCode;
                #endregion
                #region BillDetail
                System.Guid guid      = System.Guid.NewGuid();
                String      id        = guid.ToString();
                string      OrderId   = id;
                DateTime    dt        = System.DateTime.Today;
                string      InvoiNo   = ProductBill_Master.GetByBILL_ID(billid).BILLNO;
                string      InvoiDate = dt.ToString();
                string      Phone     = USERPROFILEMASTER.GetByRegistration_ID(UserId).ContactNumber;
                string      Email     = USERPROFILEMASTER.GetByRegistration_ID(UserId).Email;

                #endregion
                decimal totamt = Math.Round(ProductBill_Master.GetByBILL_ID(billid).TOTAL, 0);
                var     values = totamt.ToString(CultureInfo.InvariantCulture).Split('.');
                Int64   rup    = Convert.ToInt64(values[0]);
                Int64   paise  = 0;
                if (values.Length == 2)
                {
                    paise = Convert.ToInt64(values[1]);
                }
                string rupee = string.Empty;
                string pa    = string.Empty;
                if (paise != 0)
                {
                    pa    = Rupees(paise) + "Paise Only";
                    rupee = Rupees(rup) + "Rupees and " + pa;
                }
                else
                {
                    rupee = Rupees(rup) + "Rupees Only";
                }
                ReportViewer1.ProcessingMode = ProcessingMode.Local;
                this.ReportViewer1.LocalReport.EnableExternalImages = true;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("/Report/PickUpSale.rdlc");
                ReportDataSource  datasource = new ReportDataSource("BillGenrate", _Pro);
                ReportParameter[] rpt        = new ReportParameter[33];
                rpt[0]  = new ReportParameter("CompanyName", CompanyName);
                rpt[1]  = new ReportParameter("CompanyAddress", CompanyAddress);
                rpt[2]  = new ReportParameter("CompanyState", CompanyState);
                rpt[3]  = new ReportParameter("CompanyCity", CompanyCity);
                rpt[4]  = new ReportParameter("ZipCode", ZipCode);
                rpt[5]  = new ReportParameter("CompanyGST", CompanyGST);
                rpt[6]  = new ReportParameter("CompanyContact", CompanyContact);
                rpt[7]  = new ReportParameter("ShipName", ShipName);
                rpt[8]  = new ReportParameter("ShipAdd1", ShipAdd1);
                rpt[9]  = new ReportParameter("ShipAdd2", ShipAdd2);
                rpt[10] = new ReportParameter("ShipCity", ShipCity);
                rpt[11] = new ReportParameter("ShipState", ShipState);
                rpt[12] = new ReportParameter("ShipZip", ShipZip);
                rpt[13] = new ReportParameter("Contry", Contry);
                rpt[14] = new ReportParameter("BillName", BillName);
                rpt[15] = new ReportParameter("PermanentAdd1", PermanentAdd1);
                rpt[16] = new ReportParameter("PermanentAdd2", PermanentAdd2);
                rpt[17] = new ReportParameter("PermanentCity", PermanentCity);
                rpt[18] = new ReportParameter("PermanentState", PermanentState);
                rpt[19] = new ReportParameter("PermanentZip", PermanentZip);
                rpt[20] = new ReportParameter("Gstin", Gstin);
                rpt[21] = new ReportParameter("OrderId", OrderId);
                rpt[22] = new ReportParameter("InvoiNo", InvoiNo);
                rpt[23] = new ReportParameter("InvoiDate", InvoiDate);
                rpt[24] = new ReportParameter("Phone", Phone);
                rpt[25] = new ReportParameter("Email", Email);
                rpt[26] = new ReportParameter("TotalAmountWord", rupee);

                rpt[27] = new ReportParameter("PaymentMod", PaymentMod);
                rpt[28] = new ReportParameter("PickUpName", PickUpName);
                rpt[29] = new ReportParameter("PickUpAddress", PickUpAddress);
                rpt[30] = new ReportParameter("PickUpContact", PickUpContact);
                rpt[31] = new ReportParameter("CenterName", CenterName);
                rpt[32] = new ReportParameter("CenterCode", CenterCode);
                this.ReportViewer1.LocalReport.SetParameters(rpt);
                this.ReportViewer1.LocalReport.DataSources.Clear();
                this.ReportViewer1.LocalReport.DataSources.Add(datasource);
                this.ReportViewer1.LocalReport.Refresh();
            }
            catch (Exception ex)
            { }
        }
        protected void lnkWallet2_Click(object sender, EventArgs e)
        {
            int UserID             = int.Parse(Session["loginid"].ToString());
            USERPROFILEMASTER User = USERPROFILEMASTER.GetByRegistration_ID(UserID);

            if (User.Registration_ID > 0)
            {
                decimal UserAmount     = User.UserWallet;
                decimal TransferAmount = 5000;// totalAmount;
                if (UserAmount <= TransferAmount)
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Insufulset amount in User account.!!!')</script>", false);
                    return;
                }
                #region
                SqlConnection  cn    = new SqlConnection(constr);
                SqlCommand     cmd   = new SqlCommand("usp_SaveUserOrder", cn);
                SqlDataAdapter adptr = new SqlDataAdapter(cmd);
                DataSet        ds    = new DataSet();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@User_id", UserID);
                cn.Open();
                adptr.Fill(ds);
                cn.Close();
                orderNo     = ds.Tables[0].Rows[0]["OrderNo"].ToString();
                totalAmount = Convert.ToDecimal(ds.Tables[0].Rows[0]["TotalAmount"]);
                #endregion
                USERPROFILEMASTER lm = USERPROFILEMASTER.GetByUser_Name("OMHRD");
                if (lm.Registration_ID > 0)
                {
                    USERPROFILEMASTER lmm            = new USERPROFILEMASTER();
                    decimal           PreviousAmount = lm.UserWallet;
                    decimal           Amount         = totalAmount;
                    decimal           TotalAmount    = PreviousAmount + Amount;
                    lmm.WalletRecharge(lm.Registration_ID, TotalAmount);
                    {
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Payment successful..!!!')</script>", false);
                    }
                }
                decimal MyAmount      = User.UserWallet;
                decimal TranferAmount = totalAmount;
                decimal FinalAmount   = MyAmount - TranferAmount;
                User.WalletRecharge(User.Registration_ID, FinalAmount);
                #region SaveUserOrderPayment
                using (SqlConnection conn = new SqlConnection(constr))
                {
                    SqlDataAdapter da = new SqlDataAdapter();
                    da.InsertCommand = new SqlCommand("Insert Into UserOrderPaymenttbl (Orderid, TrackingId, BankRefNo, OrderStatus,FailureMessage,PaymentMod,CardName,StatusCode,StatusMessage,ResponseCode,PaymentDate,Amount,UserId) Values (@Orderid, @TrackingId, @BankRefNo, @OrderStatus,@FailureMessage,@PaymentMod,@CardName,@StatusCode,@StatusMessage,@ResponseCode,@PaymentDate,@Amount,@UserId)", conn);
                    da.InsertCommand.Parameters.Add("@Orderid", SqlDbType.Int).Value      = 0;
                    da.InsertCommand.Parameters.Add("@TrackingId", SqlDbType.Text).Value  = "";
                    da.InsertCommand.Parameters.Add("@BankRefNo", SqlDbType.Text).Value   = "";
                    da.InsertCommand.Parameters.Add("@OrderStatus", SqlDbType.Text).Value = "Success";

                    da.InsertCommand.Parameters.Add("@FailureMessage", SqlDbType.Text).Value = "";
                    da.InsertCommand.Parameters.Add("@PaymentMod", SqlDbType.Text).Value     = "Wallet";
                    da.InsertCommand.Parameters.Add("@CardName", SqlDbType.Text).Value       = "";
                    da.InsertCommand.Parameters.Add("@StatusCode", SqlDbType.Int).Value      = 0;

                    da.InsertCommand.Parameters.Add("@StatusMessage", SqlDbType.Text).Value   = "";
                    da.InsertCommand.Parameters.Add("@ResponseCode", SqlDbType.Int).Value     = 0;
                    da.InsertCommand.Parameters.Add("@PaymentDate", SqlDbType.DateTime).Value = System.DateTime.Now;
                    da.InsertCommand.Parameters.Add("@Amount", SqlDbType.Decimal).Value       = totalAmount;
                    da.InsertCommand.Parameters.Add("@UserId", SqlDbType.Int).Value           = UserID;
                    conn.Open();
                    da.InsertCommand.ExecuteNonQuery();
                    conn.Close();
                }
                #endregion
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Some technical error...!!!')</script>", false);
            }
        }