Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                edittable.Visible   = false;
                editsection.Visible = true;
                Customerid          = clsCommon.getCurrentCustomer().id;

                string    qry    = "select top 1 FirstName,LastName,(select CityName from CityMaster where Id= CityId) as CityName,(select StateName from StateMaster where Id= StateId) as stateName,Email,Mobile from Customer where Id=" + Customerid + "order by Id asc";
                DataTable dtcust = dbc.GetDataTable(qry);

                if (dtcust.Rows.Count > 0 && dtcust != null)
                {
                    name.InnerText    = dtcust.Rows[0]["FirstName"].ToString() + " " + dtcust.Rows[0]["LastName"].ToString();
                    city.InnerText    = dtcust.Rows[0]["CityName"].ToString();
                    state.InnerText   = dtcust.Rows[0]["stateName"].ToString();
                    email11.InnerText = dtcust.Rows[0]["Email"].ToString();
                    mobile.InnerText  = dtcust.Rows[0]["Mobile"].ToString();
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             lblDateTime.Text = String.Format("{0:ddd, MMM d, yyyy}", dbc.getindiantime());
             btnsave.Text     = "Save";
             if (Request.QueryString.AllKeys.Contains("ID"))
             {
                 if (!Request.QueryString["ID"].ToString().Equals(""))
                 {
                     btnsave.Text = "Update";
                     DataTable dt = dbc.GetDataTable("Select * from [Role] where id=" + Request.QueryString["ID"].ToString() + "");
                     if (dt.Rows.Count > 0)
                     {
                         txtrole.Text = dt.Rows[0]["RoleName"].ToString();
                     }
                 }
             }
             else if (Request.QueryString.AllKeys.Contains("DID"))
             {
                 if (!Request.QueryString["DID"].ToString().Equals(""))
                 {
                     Delete(Request.QueryString["DID"].ToString());
                 }
             }
             getdata();
         }
     }
     catch (Exception ex)
     {
         ltrErr.Text = ex.Message;
     }
 }
    public static bool CheckCustomerCode(string codeText)
    {
        dbConnection dbc     = new dbConnection();
        bool         flag    = true;
        DataTable    dtFdata = dbc.GetDataTable("select * FROM Franchisee WHERE ISActive = 1 AND [FranchiseeCustomerCode] = '" + codeText + "'");

        if (dtFdata.Rows.Count > 0)
        {
            flag = false;
            return(flag);
        }
        DataTable dtMFdata = dbc.GetDataTable("select * FROM MasterFranchisee WHERE ISActive = 1 AND [MasterFranchiseeCustomerCode] = '" + codeText + "'");

        if (dtMFdata.Rows.Count > 0)
        {
            flag = false;
            return(flag);
        }
        DataTable dtSFdata = dbc.GetDataTable("select * FROM SuperFranchisee WHERE ISActive = 1 AND [SuperFranchiseeCustomerCode] = '" + codeText + "'");

        if (dtSFdata.Rows.Count > 0)
        {
            flag = false;
            return(flag);
        }
        return(flag);
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                string    superFranchiseeqry = "Select SuperFranchiseeID as Id,SuperFranchiseeName as Name from SuperFranchisee where IsActive = 1 order by SuperFranchiseeID";
                DataTable dtSFranchisee      = dbc.GetDataTable(superFranchiseeqry);
                ddlSuperFranchisee.DataSource     = dtSFranchisee;
                ddlSuperFranchisee.DataTextField  = "Name";
                ddlSuperFranchisee.DataValueField = "Id";
                ddlSuperFranchisee.DataBind();
                ddlSuperFranchisee.Items.Insert(0, new ListItem("Select Super Franchisee", ""));

                string    masterFranchiseeqry = "Select MasterFranchiseeID as Id,MasterFranchiseeName as Name from MasterFranchisee where IsActive = 1 order by MasterFranchiseeID";
                DataTable dtMFranchisee       = dbc.GetDataTable(masterFranchiseeqry);
                ddlMasterFranchisee.DataSource     = dtMFranchisee;
                ddlMasterFranchisee.DataTextField  = "Name";
                ddlMasterFranchisee.DataValueField = "Id";
                ddlMasterFranchisee.DataBind();
                ddlMasterFranchisee.Items.Insert(0, new ListItem("Select Master Franchisee", ""));

                DataList();
            }
            catch (Exception W) { }
        }
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                dtStart = dbc.getindiantime().ToString("dd/MMM/yyyy");
                dtEnd   = dbc.getindiantime().ToString("dd/MMM/yyyy");

                txtDate.Text  = dbc.getindiantime().AddDays(-1).ToString("dd-MM-yyyy");
                txtDate1.Text = dbc.getindiantime().ToString("dd-MM-yyyy");

                IsAdmin         = Request.Cookies["TUser"]["IsAdmin"].ToString();
                sJurisdictionId = Request.Cookies["TUser"]["JurisdictionID"].ToString();

                Date();
                boxbind();

                string    queryData = "select top 1 [Product].Name,[Product].Id, CONVERT(varchar(12),EndDate,107)+' '+CONVERT(varchar(20),EndDate,108) as Enddate1,StartDate,EndDate,sold  from Product  where StartDate <= '" + dbc.getindiantimeString(true) + "' and EndDate>= '" + dbc.getindiantimeString(true) + "' ";
                DataTable dttime    = dbc.GetDataTable(queryData);

                if (dttime != null && dttime.Rows.Count > 0)
                {
                    string endtime = dttime.Rows[0]["Enddate1"].ToString();
                    string display = dttime.Rows[0]["Name"].ToString();
                    //lblenddate.Value = endtime;
                    string Id          = dttime.Rows[0]["Id"].ToString();
                    string htmlbodystr = "";
                    htmlbodystr = (@"<div><a  href='Product/ManageProducts.aspx?Id=" + Id + "' target=\"_blank\">" + display + "</a> <p class=\"inline\">- Offer Expiring After:</p> <p id=\"demo\" class=\"inline\"></p></div>");
                    //divTest.InnerHtml = htmlbodystr;
                }
            }
            catch (Exception W) { ltrErr.Text = W.Message; }
        }
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            lblmsg.Text = "";
            if (!IsPostBack)
            {
                id = Request.QueryString["Id"];

                if (id != null && !id.Equals(""))
                {
                    string    Stateqry = "Select Id as Id,StateName as Name from [StateMaster] where IsActive = 1 order by Id";
                    DataTable dtState  = dbc.GetDataTable(Stateqry);
                    ddlState.DataSource     = dtState;
                    ddlState.DataTextField  = "Name";
                    ddlState.DataValueField = "Id";
                    ddlState.DataBind();

                    string    Cityqry = "Select Id as Id,CityName as Name from [CityMaster] where IsActive = 1 order by Id";
                    DataTable dtCity  = dbc.GetDataTable(Cityqry);
                    ddlCity.DataSource     = dtCity;
                    ddlCity.DataTextField  = "Name";
                    ddlCity.DataValueField = "Id";
                    ddlCity.DataBind();

                    string    query    = "SELECT JM.JurisdictionID,JM.JurisdictionIncharge,JM.Contact,JM.EmalID,JM.StateId,JM.CityId,JM.Comments,JM.IsActive FROM JurisdictionMaster Jm INNER JOIN StateMaster sm on JM.StateId = sm.Id INNER JOIN CityMaster cm on JM.CityId = cm.Id where isnull(Jm.IsDeleted,0)=0  and JM.JurisdictionID=" + id;
                    DataTable dtUpdate = dbc.GetDataTable(query);
                    if (dtUpdate.Rows.Count > 0)
                    {
                        hdnJurisdictionID.Value      = dtUpdate.Rows[0]["JurisdictionID"].ToString();
                        txtJurisdictionIncharge.Text = dtUpdate.Rows[0]["JurisdictionIncharge"].ToString();
                        txtContact.Text        = dtUpdate.Rows[0]["Contact"].ToString();
                        txtEmailId.Text        = dtUpdate.Rows[0]["EmalID"].ToString();
                        ddlState.SelectedValue = dtUpdate.Rows[0]["StateId"].ToString();
                        ddlCity.SelectedValue  = dtUpdate.Rows[0]["CityId"].ToString();
                        txtComments.Text       = dtUpdate.Rows[0]["Comments"].ToString();
                        if (dtUpdate.Rows[0]["IsActive"].ToString() == "True")
                        {
                            chkisactive.Checked = true;
                        }
                        else
                        {
                            chkisactive.Checked = false;
                        }
                    }
                }
            }
        }
        catch (Exception ee)
        {
            lblmsg.Text = "Error:" + ee.Message + " ::: " + ee.StackTrace + " :::: " + ee.InnerException;
        }
    }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string    categoryqry = "SELECT CategoryId,CategoryName FROM Category where isnull(IsDeleted,0)=0 AND isnull(IsActive,0)=1 order by Sequence asc";
            DataTable dtcategory  = new DataTable();
            dtcategory = dbc.GetDataTable(categoryqry);
            dtcategory.Rows.Add("0", "Select Category");
            DataView dv = dtcategory.DefaultView;
            dv.Sort = "CategoryId asc";
            DataTable sortedDT = dv.ToTable();

            ddlCategoryName.DataSource     = sortedDT;
            ddlCategoryName.DataTextField  = "CategoryName";
            ddlCategoryName.DataValueField = "CategoryId";
            ddlCategoryName.DataBind();

            string    SubCategoryQry = "SELECT Id,SubCategory FROM tblSubCategory where isnull(IsActive,0)=1  AND CategoryId = '" + ddlCategoryName.SelectedValue + "' order by Id asc";
            DataTable dtSubCategory  = new DataTable();
            dtSubCategory = dbc.GetDataTable(SubCategoryQry);
            dtSubCategory.Rows.Add("0", "Select SubCategory");
            DataView dvSubCategory = dtSubCategory.DefaultView;
            dvSubCategory.Sort = "Id asc";
            DataTable sortedSubCategoryDT = dvSubCategory.ToTable();
            ddlSubCategoryName.DataSource     = sortedSubCategoryDT;
            ddlSubCategoryName.DataTextField  = "SubCategory";
            ddlSubCategoryName.DataValueField = "Id";
            ddlSubCategoryName.DataBind();

            string dtStart = dbc.getindiantime().ToString("dd/MMM/yyyy");
            string dtEnd   = dbc.getindiantime().ToString("dd/MMM/yyyy");
            startdate.Value = dtStart;
            enddate.Value   = dtEnd;
            IsAdmin         = Request.Cookies["TUser"]["IsAdmin"].ToString();
            sJurisdictionId = Request.Cookies["TUser"]["JurisdictionID"].ToString();
            IsUserType      = Request.Cookies["TUser"]["UserType"].ToString();
            loginuserId     = Request.Cookies["TUser"]["Id"];
            fillData();
            if (IsUserType == "3")
            {
                grdGrn.Columns[11].Visible = false;
            }
            grdGrn.Columns[12].Visible = false;

            if (IsUserType == "2")
            {
                grdGrn.Columns[12].Visible = false;
            }


            grdGrn.Columns[12].Visible = true;
        }
    }
Пример #8
0
    //store in varible and passs below function

    public static object custdetails(string Custid)
    {
        dbConnection dbc = new dbConnection();

        try
        {
            string currentproduct = "select top 1 Product.id from Product where StartDate<=GETDATE()AND EndDate>=GETDATE() order by Product.id desc";

            DataTable dt = dbc.GetDataTable(currentproduct);

            if (dt != null && dt.Rows.Count > 0)
            {
                string productidd = dt.Rows[0]["Id"].ToString();
                string querydata  = "select (select top 1 startdate from Product where Product.id=OrderItem.ProductId) as Productstarttime,(select top 1 startdate from Product where Product.id=OrderItem.ProductId) as Productendtime,OrderItem.Id as Orderitemid,OrderItem.ProductId as Productid,convert(varchar,[Order].CreatedOnUtc,108) as Ordertime ,convert(varchar,[Order].CreatedOnUtc,103) as Orderdate ,[Order].id as OrderId,[Order].BuyWith,ISNULL([Order].CustOfferCode,0) as CustOfferCode ,ISNULL([Order].RefferedOfferCode,0) as RefferedOfferCode  from [Order] inner join OrderItem on [Order].Id=OrderItem.OrderId where CustomerId=" + Custid + " and ProductId='" + productidd + "' and [Order].IsPaymentDone=1";

                DataTable dtorderdata = dbc.GetDataTable(querydata);

                if (dtorderdata != null && dtorderdata.Rows.Count > 0)
                {
                    clsModals.custorderdetails objcustdataa = new clsModals.custorderdetails();
                    {
                        objcustdataa.Response         = "1";
                        objcustdataa.Message          = "Successfully Done";
                        objcustdataa.Orderid          = dtorderdata.Rows[0]["OrderId"].ToString();
                        objcustdataa.OrderItemId      = dtorderdata.Rows[0]["Orderitemid"].ToString();
                        objcustdataa.ProductId        = dtorderdata.Rows[0]["Productid"].ToString();
                        objcustdataa.Buywith          = dtorderdata.Rows[0]["BuyWith"].ToString();
                        objcustdataa.OrderDate        = dtorderdata.Rows[0]["Orderdate"].ToString();
                        objcustdataa.OrderTime        = dtorderdata.Rows[0]["Ordertime"].ToString();
                        objcustdataa.Custoffercode    = dtorderdata.Rows[0]["CustOfferCode"].ToString();
                        objcustdataa.ReferCode        = dtorderdata.Rows[0]["RefferedOfferCode"].ToString();
                        objcustdataa.ProductEnddate   = dtorderdata.Rows[0]["Productendtime"].ToString();
                        objcustdataa.ProductStartDate = dtorderdata.Rows[0]["Productstarttime"].ToString();
                        return(objcustdataa);
                    }
                }
                else
                {
                    clsModals.custorderdetails objcust1 = new clsModals.custorderdetails();
                    objcust1.Response = "0";
                    objcust1.Message  = "No Data Found";
                }
            }

            clsModals.custorderdetails objcust = new clsModals.custorderdetails();
            objcust.Response = "0";
            objcust.Message  = "No Data Found";
        }
        catch (Exception ee)
        {
        }
        return("");
    }
Пример #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //object data = clsCommon.custdetails("1");
            Getdata();
            if (!IsPostBack)
            {
                qty();

                if (!string.IsNullOrWhiteSpace(Request.QueryString["offercode"]))
                {
                    string couponcode = Request.QueryString["offercode"].ToString();


                    string    query  = "select OrderTotal,BuyWith from [order] where CustOfferCode='" + couponcode + "'";
                    DataTable dtcode = dbc.GetDataTable(query);
                    if (dtcode.Rows.Count > 0)
                    {
                        string value1 = dtcode.Rows[0]["BuyWith"].ToString();

                        //qty();
                        if (value1 == "1")
                        {
                            //BuyOne.Text = "Buy For " + clsCommon.rssymbol + dtcode.Rows[0]["OrderTotal"].ToString();
                            //BuyOneWithFriend.Visible = false;
                            //BuyFivewithFriend.Visible = false;
                        }
                        else if (value1 == "2")
                        {
                            //BuyOne.Visible = false;
                            //BuyOneWithFriend.Text = "Buy For " + clsCommon.rssymbol + dtcode.Rows[0]["OrderTotal"].ToString();
                            //BuyFivewithFriend.Visible = false;
                        }
                        else if (value1 == "6")
                        {
                            //BuyOne.Visible = false;
                            //BuyOneWithFriend.Visible = false;
                            //BuyFivewithFriend.Text = "Buy For " + clsCommon.rssymbol + dtcode.Rows[0]["OrderTotal"].ToString();
                        }

                        //  whtp.InnerHtml = "<a target=\"_blank\" href='https://web.whatsapp.com/send?text=Hello!l like this product on Sosho.in and thought of sharing with you! They’ve got some amazing group buy discounts, valid only till 25 oct 2019 12:00 PM. How about we buy it together?' data-action=\"share/whatsapp/share\"><img id=\"web\" src=\"images/whatsapp.png\" /></a><a target=\"_blank\" href=\"whatsapp://send?text=Hello!l like this product on Sosho.in and thought of sharing with you! They’ve got some amazing group buy discounts, valid only till 25 oct 2019 12:00 PM. How about we buy it together?\"><img id=\"mo-wa\" src=\"images/whatsapp.png\" /></a>";
                    }
                }
            }
        }
        catch (Exception ee)
        {
        }
    }
Пример #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataTable dt1;
         dt1 = dbc.GetDataTable("SELECT [per_type],[per_amount],[min_order_amount] FROM [dbo].[tblWalletUsageMaster] where ISNULL(is_deleted,0)=0 ");
         if (dt1.Rows.Count > 0)
         {
             ddlgrpType.SelectedValue = dt1.Rows[0]["per_type"].ToString();
             txtgrpTypeValue.Text     = dt1.Rows[0]["per_amount"].ToString();
             txtgrpMinOrderAmt.Text   = dt1.Rows[0]["min_order_amount"].ToString();
         }
     }
 }
Пример #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            lblmsg.Text = "";
            if (!IsPostBack)
            {
                chkisactive.Checked = true;
                id = Request.QueryString["Id"];
                if (id != null && !id.Equals(""))
                {
                    BtnSave.Text = "Update";

                    string    query    = "SELECT CategoryID,CategoryName,CategoryDescription,IsActive,IsDefault,CreatedOn,CategoryImage, Sequence FROM Category where isnull(IsDeleted,0)=0  and CategoryID = " + id;
                    DataTable dtUpdate = dbc.GetDataTable(query);
                    if (dtUpdate.Rows.Count > 0)
                    {
                        txtCategoryName.Text = dtUpdate.Rows[0]["CategoryName"].ToString();
                        txtDescription.Text  = dtUpdate.Rows[0]["CategoryDescription"].ToString();
                        txtSequence.Text     = dtUpdate.Rows[0]["Sequence"].ToString();
                        if (dtUpdate.Rows[0]["IsActive"].ToString() == "True")
                        {
                            chkisactive.Checked = true;
                        }
                        else
                        {
                            chkisactive.Checked = false;
                        }


                        if (dtUpdate.Rows[0]["IsDefault"].ToString() == "True")
                        {
                            chkIsDefault.Checked = true;
                        }
                        else
                        {
                            chkIsDefault.Checked = false;
                        }

                        CategoryImage.ImageUrl = "../CategoryImage/" + dtUpdate.Rows[0]["CategoryImage"].ToString();
                    }
                }
            }
        }
        catch (Exception ee)
        {
            lblmsg.Text = "Error:" + ee.Message + " ::: " + ee.StackTrace + " :::: " + ee.InnerException;
        }
    }
Пример #12
0
    public void BindData(string TempleteId)
    {
        DataTable dt = new DataTable();

        dt = dbCon.GetDataTable("Select * from [MessageTemplate] Where Id=" + TempleteId);
        if (dt != null && dt.Rows.Count > 0)
        {
            lblTempleteID.Text      = dt.Rows[0]["Id"].ToString();
            txtname.Text            = dt.Rows[0]["Name"].ToString();
            chkisActive.Checked     = dt.Rows[0]["IsActive"].ToString().Equals("True") ? true : false;
            txtSubject.Text         = dt.Rows[0]["Subject"].ToString();
            txtFullDescription.Text = dt.Rows[0]["Body"].ToString();
            cmbMailAccount.Value    = dt.Rows[0]["EmailAccountId"].ToString();
        }
    }
Пример #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            lblmsg.Text = "";
            if (!IsPostBack)
            {
                string    categoryqry = "SELECT CategoryId,CategoryName FROM Category where isnull(IsDeleted,0)=0 order by Sequence asc";
                DataTable dtcategory  = dbc.GetDataTable(categoryqry);
                ddlCategoryName.DataSource     = dtcategory;
                ddlCategoryName.DataTextField  = "CategoryName";
                ddlCategoryName.DataValueField = "CategoryId";
                ddlCategoryName.DataBind();

                chkisactive.Checked = true;
                id = Request.QueryString["Id"];
                if (id != null && !id.Equals(""))
                {
                    BtnSave.Text = "Update";



                    string query = "SELECT CategoryID,SubCategory,Description,IsActive,CreatedOn,Sequence " +
                                   " FROM tblSubCategory where isnull(IsDeleted,0)=0  and Id = " + id;
                    DataTable dtUpdate = dbc.GetDataTable(query);
                    if (dtUpdate.Rows.Count > 0)
                    {
                        ddlCategoryName.SelectedValue = dtUpdate.Rows[0]["CategoryID"].ToString();
                        txtSubCategoryName.Text       = dtUpdate.Rows[0]["SubCategory"].ToString();
                        txtDescription.Text           = dtUpdate.Rows[0]["Description"].ToString();
                        txtSequence.Text = dtUpdate.Rows[0]["Sequence"].ToString();
                        if (dtUpdate.Rows[0]["IsActive"].ToString() == "True")
                        {
                            chkisactive.Checked = true;
                        }
                        else
                        {
                            chkisactive.Checked = false;
                        }
                    }
                }
            }
        }
        catch (Exception ee)
        {
            lblmsg.Text = "Error:" + ee.Message + " ::: " + ee.StackTrace + " :::: " + ee.InnerException;
        }
    }
Пример #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string    qry = "SELECT [Id],[ImgURL],[Key],[Value] FROM [WhatsAppMsg]";
        DataTable dt  = dbc.GetDataTable(qry);

        if (dt != null && dt.Rows.Count > 0)
        {
            HiddenField1.Value = dt.Rows[0]["Key"].ToString();
            TextBox1.Text      = dt.Rows[0]["Value"].ToString();

            HiddenField2.Value = dt.Rows[1]["Key"].ToString();
            TextBox2.Text      = dt.Rows[1]["Value"].ToString();

            HiddenField3.Value = dt.Rows[2]["Key"].ToString();
            TextBox3.Text      = dt.Rows[2]["Value"].ToString();

            HiddenField4.Value = dt.Rows[3]["Key"].ToString();
            TextBox4.Text      = dt.Rows[3]["Value"].ToString();

            HiddenField5.Value = dt.Rows[4]["Key"].ToString();
            TextBox5.Text      = dt.Rows[4]["Value"].ToString();

            HiddenField6.Value = dt.Rows[5]["Key"].ToString();
            TextBox6.Text      = dt.Rows[5]["Value"].ToString();
        }
    }
Пример #15
0
    public static string GetMainCourse(string id)
    {
        try
        {
            dbConnection dbc = new dbConnection();
            string       cid = id;

            string    QUESTATE = "SELECT Id,statename from  StateMaster where IsActive=1 and CountryId='" + id + "' order by id asc";
            DataTable dt       = dbc.GetDataTable(QUESTATE);

            string response = "";
            if (dt.Rows.Count > 0)
            {
                DataView dv = dt.DefaultView;
                dv.Sort = "Id asc";
                dt      = dv.ToTable();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    response = response + dt.Rows[i]["id"].ToString() + ",";
                    response = response + dt.Rows[i]["StateName"].ToString() + "###";
                }
                response = response.TrimEnd('#');
                return(response);
            }
            return(response);
        }
        catch
        {
            return(null);
        }
    }
Пример #16
0
 public void getdata()
 {
     try
     {
         //lblmsg.Text = "";
         //DataTable dtdata = dbc.GetDataTable("select Customer.Id,Customer.Mobile,(select top 1 concat(CustomerAddress.FirstName, ' ' ,CustomerAddress.LastName )from CustomerAddress where CustomerAddress.CustomerId=Customer.Id)as Name,(select top 1 CustomerAddress.Address from CustomerAddress where CustomerAddress.CustomerId=Customer.Id)as CustAddress,(select top 1 CustomerAddress.PinCode from CustomerAddress where CustomerAddress.CustomerId=Customer.Id)as CustPin from Customer Order By Customer.Id Desc");
         DataTable dtdata = dbc.GetDataTable("select Customer.Id,Customer.Mobile,(select top 1 concat(CustomerAddress.FirstName, ' ' ,CustomerAddress.LastName )from CustomerAddress where CustomerAddress.CustomerId=Customer.Id)as Name,(select top 1 CustomerAddress.Address from CustomerAddress where CustomerAddress.CustomerId=Customer.Id)as CustAddress,(select top 1 CustomerAddress.PinCode from CustomerAddress where CustomerAddress.CustomerId=Customer.Id)as CustPin from Customer where Customer.Mobile not in (select tblExcludedMobileNumbers.ExcludedNumber from tblExcludedMobileNumbers) Order By Customer.Id Desc");
         if (dtdata.Rows.Count > 0)
         {
             grd.Caption    = "Total Product: " + dtdata.Rows.Count;
             grd.DataSource = dtdata;
             grd.DataBind();
         }
         else
         {
             dtdata         = new DataTable();
             grd.Caption    = "Total Product: " + dtdata.Rows.Count;
             grd.DataSource = dtdata;
             grd.DataBind();
         }
     }
     catch (Exception ex)
     {
         //throw ex;
     }
 }
Пример #17
0
    public static string SaveData1(string Id)
    {
        dbConnection dbc1 = new dbConnection();

        try
        {
            if (dbc1.ExecuteQuery("Update [order] set OrderStatusId=90 where id=" + Id) > 0)
            {
                string qry = "SELECT Customer.Mobile, [Order].Id From [Order] INNER JOIN Customer ON [Order].CustomerId = Customer.Id where [Order].Id=" + Id;

                DataTable dt   = dbc1.GetDataTable(qry);
                string    mono = "";
                string    sms  = "";
                if (dt != null && dt.Rows.Count > 0)
                {
                    string oid = dt.Rows[0]["Id"].ToString();
                    mono = dt.Rows[0]["Mobile"].ToString();
                    sms  = "Your SoSho order number " + oid + " has been cancelled. We would like to see you around again. Get more discounts and offers only on https://sosho.in.";
                }
                dbc1.SendSMS(mono, sms);
            }
            return("1");
        }
        catch (Exception ex)
        {
        }
        return("0");
    }
Пример #18
0
    public static string DeleteAddress(string id)
    {
        try
        {
            dbConnection dbc       = new dbConnection();
            string       AddressId = id;

            string    QUESTATE = "select CustomerAddress.Id as addrid,FirstName,LastName,MobileNo,(select TagName from TagMaster where TagMaster.Id=CustomerAddress.TagId and TagMaster.IsActive=1)as tagName,Address,(select CityName from CityMaster where CityMaster.IsActive=1 and CityMaster.id=CustomerAddress.CityId) as City,(select statename from StateMaster where StateMaster.id=CustomerAddress.StateId and StateMaster.IsActive=1)as statename,PinCode  from CustomerAddress where CustomerAddress.IsActive=1 and CustomerAddress.IsDeleted=0 and len(PinCode)>=6 and CustomerAddress.Id=" + AddressId + "";
            DataTable dt       = dbc.GetDataTable(QUESTATE);

            string response = "";
            if (dt.Rows.Count > 0)
            {
                string updae = "update CustomerAddress set IsActive=0 where CustomerAddress.id=" + AddressId + "";
                int    i     = dbc.ExecuteQuery(updae);
                i = 1;

                if (i > 0)
                {
                    response = "1";
                }
            }
            return(response);
        }
        catch
        {
            return(null);
        }
    }
Пример #19
0
        public static string getProductExpiredOnDate(string prodid)
        {
            dbConnection dbc = new dbConnection();

            string where = "";
            if (prodid == "")
            {
                where = "where Product.StartDate<='" + dbc.getindiantime().ToString("dd-MMM-yyyy") + " 00:00:00' AND EndDate>='" + dbc.getindiantime().ToString("dd-MMM-yyyy") + " 23:59:59'";
            }
            else
            {
                where = "where Product.Id=" + prodid + "";
            }

            string    date  = "select CONVERT(varchar,EndDate,106) as dateprod, CONVERT(varchar,EndDate,100)as timeprod from Product " + where + " ";
            DataTable dt    = dbc.GetDataTable(date);
            string    edate = "";

            if (dt != null && dt.Rows.Count > 0)
            {
                edate = dt.Rows[0]["dateprod"].ToString();

                string timeeeee = "";

                string   timeee = dt.Rows[0]["timeprod"].ToString();
                string[] time   = timeee.Split(' ');
                int      t1     = time.Length;
                timeeeee = time[t1 - 1];
                edate    = edate + ' ' + timeeeee;
            }
            return(edate);
        }
Пример #20
0
        public CancelWalletModel CancelWallet(String CustomerId, String OrderTotal, String Redemeamount = "")
        {
            CancelWalletModel objcancelwallet = new CancelWalletModel();

            try
            {
                decimal redemAmount = Convert.ToDecimal(Redemeamount);
                decimal amount      = Convert.ToDecimal(OrderTotal);

                DataTable dtWallet = dbCon.GetDataTable("select customerid,(sum(Cr_Amount)-sum(Dr_Amount))as balance from Customer_Wallet_History where customerid=" + CustomerId + " group by customerid");

                if (dtWallet != null && dtWallet.Rows.Count > 0)
                {
                    objcancelwallet.resultflag       = "1";
                    objcancelwallet.Message          = "";
                    objcancelwallet.Amount           = (amount + redemAmount).ToString();
                    objcancelwallet.WalletAmount     = "" + dtWallet.Rows[0]["balance"].ToString();
                    objcancelwallet.WalletAmountText = "MONEY IN YOUR WALLET :";
                    objcancelwallet.TotalAmount      = (amount + redemAmount).ToString();
                }
                else
                {
                    objcancelwallet.resultflag = "0";
                    objcancelwallet.Message    = "Service is not available";
                }
            }
            catch (Exception ex)
            {
            }
            return(objcancelwallet);
        }
Пример #21
0
        public AvalilableBalance AvailableBal(String Custid)
        {
            AvalilableBalance objredeem = new AvalilableBalance();

            try
            {
                dbConnection dbc = new dbConnection();

                DataTable dtWallet = dbc.GetDataTable("select CustomerId,(sum(Cr_Amount)-sum(Dr_Amount)) as avlbal,SUM(Dr_Amount)as Usedamt from Customer_Wallet_History where CustomerId=" + Custid + "  group by customerid");
                if (dtWallet.Rows.Count > 0)
                {
                    objredeem.UsedBalance   = dtWallet.Rows[0]["Usedamt"].ToString();
                    objredeem.AvalilableBal = dtWallet.Rows[0]["avlbal"].ToString();
                    objredeem.resultflag    = "1";
                    objredeem.Message       = "Success";
                }
                else
                {
                    objredeem.UsedBalance   = "0.00";
                    objredeem.AvalilableBal = "0.00";
                    objredeem.resultflag    = "1";
                    objredeem.Message       = "Success";
                }
            }
            catch (Exception ex)
            {
                objredeem.resultflag = "0";
                objredeem.Message    = "Service is not available";
            }
            return(objredeem);
        }
Пример #22
0
    public static string GetCityList(string id)
    {
        try
        {
            dbConnection dbc = new dbConnection();
            string       cid = id;

            string    quecity = "SELECT  Id,CityName from  CityMaster where IsActive=1 AND StateId='" + id + "' order by id asc";
            DataTable dt      = dbc.GetDataTable(quecity);

            string response = "";
            if (dt.Rows.Count > 0)
            {
                DataView dv = dt.DefaultView;
                dv.Sort = "ID asc";
                dt      = dv.ToTable();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    response = response + dt.Rows[i]["id"].ToString() + ",";
                    response = response + dt.Rows[i]["Cityname"].ToString() + "###";
                }
                response = response.TrimEnd('#');
                return(response);
            }
            return(response);
        }
        catch
        {
            return(null);
        }
    }
Пример #23
0
        public string Notification(string CustomerId)
        {
            dbConnection dbc      = new dbConnection();
            string       responce = "";

            try
            {
                string    custdetail = "select Id,FirstName +' ' + LastName as Name,Mobile from Customer where Customer.Id=" + CustomerId;
                DataTable dtCust     = dbc.GetDataTable(custdetail);
                if (dtCust != null && dtCust.Rows.Count > 0)
                {
                    string mobileno = dtCust.Rows[0]["Mobile"].ToString();
                    bool   restult  = SendCustomerNotificatio(mobileno, "New Product Available Now! ", "", dtCust.Rows[0]["Id"].ToString(), "");
                    if (restult == true)
                    {
                        return(responce = "Success");
                    }
                    else
                    {
                        return(responce = "Fail");
                    }
                }
                else
                {
                    return(responce = "Fail");
                }
            }
            catch (Exception)
            {
                return(responce = "Fail");
            }
        }
Пример #24
0
        public static bool SendEmailForFranchies(string sTo, string sFrom, string sSubject, string sBody)
        {
            bool         functionReturnValue = false;
            dbConnection dbCon = new dbConnection();

            try
            {
                var       settingData   = " SELECT TOP 1 * FROM tblGeneralSettings ";
                DataTable dtsettingData = dbCon.GetDataTable(settingData);
                if (dtsettingData != null && dtsettingData.Rows.Count > 0)
                {
                    var mail = new System.Net.Mail.MailMessage(dtsettingData.Rows[0]["SMTPUsername"].ToString(), sTo);
                    mail.Subject    = sSubject;
                    mail.Body       = sBody;
                    mail.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host      = dtsettingData.Rows[0]["SMTPServer"].ToString();
                    smtp.EnableSsl = false;
                    NetworkCredential networkCredential = new NetworkCredential(dtsettingData.Rows[0]["SMTPUsername"].ToString(), dtsettingData.Rows[0]["SMTPPassword"].ToString());
                    smtp.UseDefaultCredentials = true;
                    smtp.Credentials           = networkCredential;
                    smtp.Port = Convert.ToInt32(dtsettingData.Rows[0]["portNum"]);
                    smtp.Send(mail);
                }
                functionReturnValue = true;
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(functionReturnValue);
        }
Пример #25
0
    public static string SaveData(string Id)
    {
        dbConnection dbc1 = new dbConnection();

        try
        {
            if (dbc1.ExecuteQuery("Update [order] set OrderStatusId=70 where id=" + Id) > 0)
            {
                string qry = "SELECT Customer.Mobile, [Order].Id From [Order] INNER JOIN Customer ON [Order].CustomerId = Customer.Id where [Order].Id=" + Id;

                DataTable dt   = dbc1.GetDataTable(qry);
                string    mono = "";
                string    sms  = "";
                if (dt != null && dt.Rows.Count > 0)
                {
                    string oid = dt.Rows[0]["Id"].ToString();
                    mono = dt.Rows[0]["Mobile"].ToString();
                    sms  = "Your SoSho order ID " + oid + " has been successfully delivered. We hope that you like our product. To get more discounted offers, stay updated on SoSho.in";
                }
                dbc1.SendSMS(mono, sms);
            }
            return("1");
        }
        catch (Exception ex)
        {
        }
        return("0");
    }
Пример #26
0
    private void DataList(bool bclick)
    {
        String from = txtdt.Text.ToString();
        String to   = txtdt1.Text.ToString();

        String[] StrPart = from.Split('/');

        String[] StrPart1 = to.Split('/');
        string   query    = "SELECT [Id],[Name],[StartDate],[EndDate],Product.IsActive AS IsActive,[Mrp] as MRP,[Offer] as Offer,[BuyWith1FriendExtraDiscount] as BuyWith1Friend,[BuyWith5FriendExtraDiscount] as BuyWith5Friend,Product.JurisdictionId,JM.JurisdictionIncharge FROM [dbo].[Product] LEFT JOIN JurisdictionMaster JM on JM.JurisdictionId = Product.JurisdictionId where Product.IsDeleted=0 and isnull(IsApproved,0) = 0 ";

        if (bclick)
        {
            query += " and convert(date,DOC,103)>='" + StrPart[2] + "-" + StrPart[1] + "-" + StrPart[0] + "' and convert(date,DOC,103)<='" + StrPart1[2] + "-" + StrPart1[1] + "-" + StrPart1[0] + "'";
        }

        query += " order by EndDate desc ";

        DataTable dtbannerlist = dbc.GetDataTable(query);

        if (dtbannerlist.Rows.Count > 0)
        {
            gvproductlist.DataSource = dtbannerlist;
            gvproductlist.DataBind();
        }
    }
Пример #27
0
    private void DataList()
    {
        // String from = txtdt.Text.ToString();
        // String to = txtdt1.Text.ToString();

        // String[] StrPart = from.Split('/');

        // String[] StrPart1 = to.Split('/');

        int isActive = 0;

        if (chkisactive.Checked)
        {
            isActive = 1;
        }

        string query = "SELECT CategoryID,CategoryName,CategoryDescription,IsActive,CreatedOn FROM Category where isnull(IsDeleted,0)= 0 AND ISNULL(ISActive,0) = " + isActive +
                       " order by Sequence";
        //" and convert(date,CreatedOn,103)>='" + StrPart[2] + "-" + StrPart[1] + "-" + StrPart[0] + "' and convert(date,CreatedOn,103)<='" + StrPart1[2] + "-" + StrPart1[1] + "-" + StrPart1[0] + "' "

        DataTable dtbannerlist = dbc.GetDataTable(query);

        if (dtbannerlist.Rows.Count > 0)
        {
            gvCategorylist.DataSource = dtbannerlist;
            gvCategorylist.DataBind();
        }
    }
Пример #28
0
        public static void SendFranchiesEmail(string Email, string Name, string Mobile, string Address, string PinCode)
        {
            dbConnection  dbCon         = new dbConnection();
            StringBuilder sContent      = new StringBuilder();
            string        sEmailBody    = "";
            var           settingData   = " SELECT TOP 1 * FROM tblGeneralSettings ";
            DataTable     dtsettingData = dbCon.GetDataTable(settingData);

            if (dtsettingData != null && dtsettingData.Rows.Count > 0)
            {
                sContent.Append("<tr><td>&#160;</td></tr>");
                sContent.Append("<tr><td style=\"color:cornflowerblue;\">Hello,</td></tr>");
                sContent.Append("<tr><td>&#160;</td></tr>");
                sContent.Append("<tr><td style=\"color:cornflowerblue;\"> Inquiry For Franchisee </td></tr>");
                sContent.Append("<tr><td>&#160;</td></tr>");
                sContent.Append("<tr><td style=\"color:cornflowerblue;\"> Name: " + Name + "</td></tr>");
                sContent.Append("<tr><td style=\"color:cornflowerblue;\"> Mobile No: " + Mobile + " </td></tr>");
                sContent.Append("<tr><td style=\"color:cornflowerblue;\"> Email: " + Email + " </td></tr>");
                sContent.Append("<tr><td style=\"color:cornflowerblue;\"> Address: " + Address + ", " + PinCode + " </td></tr>");
                sContent.Append("<tr><td>&#160;</td></tr>");
                sContent.Append("<tr><td style=\"color:cornflowerblue;\">Thank You!!</td></tr>");
                sContent.Append("<tr><td>&#160;</td></tr>");
                sContent.Append("<tr><td>&#160;</td></tr>");
                sContent.Append("<tr><td style=\"color:cornflowerblue;\">Regards,</td></tr>");

                sContent.Append("<tr><td style=\"color:cornflowerblue;\">" + dtsettingData.Rows[0]["ContactPerson"].ToString() + "</td></tr>");
                sContent.Append("<tr><td style=\"color:cornflowerblue;\">" + dtsettingData.Rows[0]["Designation"].ToString() + "</td></tr>");
                sEmailBody = GetEmailBody("", sContent.ToString());
                SendEmailForFranchies(dtsettingData.Rows[0]["EmailAddress"].ToString(), "", "Inquiry For Franchisee", sEmailBody);
            }
        }
Пример #29
0
    public static string SavePaymentStatusHistory(string OrderId, string ReceiveAmount)
    {
        dbConnection dbc1     = new dbConnection();
        int          IsUserId = Convert.ToInt32(loginuserId);
        int          statusId = 40;//Payment Received-Sosho

        if (IsUserType == "3")
        {
            statusId = 20;//Payment Received-Delivery
        }
        else if (IsUserType == "2")
        {
            statusId = 30;//Payment Received-Frenchies
        }

        DateTime  dt          = DateTime.Now;
        DataTable dtchkExists = dbc1.GetDataTable("SELECT Top 1 PHistoryid FROM  [dbo].[tblPaymentHistory] WHERE orderId = " + OrderId + " AND userid = " + IsUserId + " AND UserType = " + IsUserType + " Order by PHistoryid desc");

        if (dtchkExists.Rows.Count > 0)
        {
            string historyId = dtchkExists.Rows[0]["PHistoryid"].ToString();
            string updateQry = " UPDATE tblPaymentHistory SET OrderId = " + OrderId + " , ReceiveAmount = " + ReceiveAmount + " UserId = " + IsUserId +
                               " , UserType = " + IsUserType + ", ReceiveDate = '" + dt.ToString() + "',StatusId = " + statusId + ",ModifiedOn = '" + dt.ToString() + "',ModifiedBy = " + IsUserId +
                               " Where PHistoryId = " + historyId;
            dbc1.ExecuteQuery(updateQry);
        }
        else
        {
            string query = "INSERT INTO [dbo].[tblPaymentHistory] ([OrderId] ,[ReceiveAmount],[UserId],[UserType],[ReceiveDate],[StatusId],[IsActive],[IsDeleted],[CreatedOn],[CreatedBy]) " +
                           " VALUES ('" + OrderId + "','" + ReceiveAmount + "','" + IsUserId + "','" + IsUserType + "','" + dt.ToString() + "'," + statusId + ",1,0,'" + dt.ToString() + "'," + IsUserId + ")";
            int VAL = dbc1.ExecuteQuery(query);
        }
        return("1");
    }
Пример #30
0
    private void DataList()
    {
        string UserType     = Request.Cookies["TUser"]["UserType"].ToString();
        string FranchiseeId = Request.Cookies["TUser"]["FranchiseeId"].ToString();
        String from         = txtdt.Text.ToString();
        String to           = txtdt1.Text.ToString();

        String[] StrPart = from.Split('/');

        String[] StrPart1 = to.Split('/');
        string   query    = string.Empty;

        if (UserType == "4")
        {
            query = "SELECT C.Id, C.DOC as [RegistrationDate], C.Mobile, isnull(C.FirstName, '') as FirstName, isnull(C.LastName, '') as LastName " +
                    " FROM [customer_franchise_link] FL " +
                    " INNER JOIN Franchisee F ON F.FranchiseeCustomerCode = FL.fcode" +
                    " LEFT OUTER JOIN Customer C ON C.Mobile = FL.Mobile " +
                    " where convert(date, FL.CreatedOn, 103) >= '" + StrPart[2] + "-" + StrPart[1] + "-" + StrPart[0] + "' and convert(date, FL.CreatedOn,103)<= '" + StrPart1[2] + "-" + StrPart1[1] + "-" + StrPart1[0] + "'" +
                    " AND F.FranchiseeId = " + FranchiseeId +
                    " order by C.Id desc ";
        }
        else if (UserType == "5")
        {
            query = "SELECT C.Id, C.DOC as [RegistrationDate], C.Mobile, isnull(C.FirstName, '') as FirstName, isnull(C.LastName, '') as LastName " +
                    " FROM [customer_franchise_link] FL " +
                    " LEFT OUTER JOIN Customer C ON C.Mobile = FL.Mobile " +
                    " where convert(date, FL.CreatedOn, 103) >= '" + StrPart[2] + "-" + StrPart[1] + "-" + StrPart[0] + "' and convert(date, FL.CreatedOn,103)<= '" + StrPart1[2] + "-" + StrPart1[1] + "-" + StrPart1[0] + "'" +
                    "   AND (FL.fcode in (select M.MasterFranchiseeCustomerCode from MasterFranchisee M where M.MasterFranchiseeId = " + FranchiseeId + ") " +
                    "        OR FL.fcode in (select F.FranchiseeCustomerCode from Franchisee F where F.MasterFranchiseeId = " + FranchiseeId + ")) " +
                    " order by C.Id desc ";
        }
        else if (UserType == "6")
        {
            query = "SELECT C.Id, C.DOC as [RegistrationDate], C.Mobile, isnull(C.FirstName, '') as FirstName, isnull(C.LastName, '') as LastName " +
                    " FROM [customer_franchise_link] FL " +
                    " LEFT OUTER JOIN Customer C ON C.Mobile = FL.Mobile " +
                    " where convert(date, FL.CreatedOn, 103) >= '" + StrPart[2] + "-" + StrPart[1] + "-" + StrPart[0] + "' and convert(date, FL.CreatedOn,103)<= '" + StrPart1[2] + "-" + StrPart1[1] + "-" + StrPart1[0] + "'" +
                    "   AND (FL.fcode in (select S.SuperFranchiseeCustomerCode from SuperFranchisee S where S.SuperFranchiseeId = " + FranchiseeId + ") " +
                    "        OR FL.fcode in (select M.MasterFranchiseeCustomerCode from MasterFranchisee M where M.SuperFranchiseeId = " + FranchiseeId + ") " +
                    "        OR FL.fcode in (select FL.FranchiseeCustomerCode from Franchisee FL where FL.MasterFranchiseeId IN (select ML.MasterFranchiseeId from MasterFranchisee ML where ML.SuperFranchiseeId = " + FranchiseeId + ")) " +
                    "        OR FL.fcode in (select F.FranchiseeCustomerCode from Franchisee F where F.SuperFranchiseeId = " + FranchiseeId + ")) " +
                    " order by C.Id desc ";
        }
        else
        {
            query = "SELECT Id, DOC as [RegistrationDate], Mobile, isnull(FirstName, '') as FirstName, isnull(LastName, '') as LastName " +
                    " from customer " +
                    " where convert(date, DOC, 103) >= '" + StrPart[2] + "-" + StrPart[1] + "-" + StrPart[0] + "' and convert(date, DOC,103)<= '" + StrPart1[2] + "-" + StrPart1[1] + "-" + StrPart1[0] + "'" +
                    " order by Id desc ";
        }
        DataTable dtReglist = dbc.GetDataTable(query);

        if (dtReglist.Rows.Count > 0)
        {
            gvRegisterlist.DataSource = dtReglist;
            gvRegisterlist.DataBind();
        }
    }