Пример #1
0
 protected void btnsave_Click(object sender, EventArgs e)
 {
     try
     {
         if (Request.QueryString.AllKeys.Contains("ID"))
         {
             if (!Request.QueryString["ID"].ToString().Equals(""))
             {
                 if (txtname.Text.Trim() != "" && txturl.Text.Trim() != "")
                 {
                     string[] ins = { txtname.Text.Trim(), txturl.Text.Trim() };
                     int      i   = dbc.ExecuteQueryWithParams("update Pages set Name=@1,PageUrl=@2 where id=" + Request.QueryString["ID"].ToString() + "", ins);
                     if (i > 0)
                     {
                         Response.Redirect("~/RoleManagement/AddPages.aspx", false);
                     }
                 }
                 else
                 {
                     getdata();
                     ltrerr.Text = "Please fill all details";
                 }
             }
         }
         else
         {
             if (txtname.Text.Trim() != "" && txturl.Text.Trim() != "")
             {
                 string[] ins = { txtname.Text.Trim(), txturl.Text.Trim() };
                 int      i   = dbc.ExecuteQueryWithParams("insert into Pages (Name,PageUrl,doc) values(@1,@2,Dateadd(Minute,330,Getutcdate()))", ins);
                 if (i > 0)
                 {
                     getdata();
                     ltrerr.Text  = "Inserted Successfully";
                     txtname.Text = "";
                     txturl.Text  = "";
                 }
                 else
                 {
                     getdata();
                     ltrerr.Text = "Not Inserted";
                 }
             }
             else
             {
                 getdata();
                 ltrerr.Text = "Please fill all details";
             }
         }
     }
     catch (Exception ex)
     {
         ltrerr.Text = ex.Message;
     }
 }
Пример #2
0
 protected void cmdSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (Request.QueryString.AllKeys.Contains("ID"))
         {
             if (!Request.QueryString["ID"].ToString().Equals(""))
             {
                 if (txtrole.Text.Trim() != "")
                 {
                     string[] ins = { txtrole.Text.Trim() };
                     int      i   = dbc.ExecuteQueryWithParams("update Role set RoleName=@1 where id=" + Request.QueryString["ID"].ToString() + "", ins);
                     if (i > 0)
                     {
                         Response.Redirect("~/RoleManagement/Role.aspx", false);
                     }
                 }
                 else
                 {
                     getdata();
                     ltrErr.Text = "Please fill all details";
                 }
             }
         }
         else
         {
             if (txtrole.Text.Trim() != "")
             {
                 string[] ins = { txtrole.Text.Trim() };
                 int      i   = dbc.ExecuteQueryWithParams("insert into Role (RoleName) values(@1)", ins);
                 if (i > 0)
                 {
                     getdata();
                     ltrErr.Text  = "Inserted Successfully";
                     txtrole.Text = "";
                 }
                 else
                 {
                     getdata();
                     ltrErr.Text = "Not Inserted";
                 }
             }
             else
             {
                 getdata();
                 ltrErr.Text = "Please fill all details";
             }
         }
     }
     catch (Exception ex)
     {
         ltrErr.Text = ex.Message;
     }
 }
Пример #3
0
        public static void InsertLogs(InvoiceLOGS.InvoiceLogLevel Logtype, string tranid = "", int paymentmethod = 0, bool issuccess = false, String ShortMsg = "", String detailmsg = "")
        {
            dbConnection dbc = new dbConnection();

            try
            {
                DateTime curr_time = dbc.getindiantime();

                int logtypeid = 0;


                logtypeid = (int)Logtype;


                if (InvoiceLOGS.InvoiceLogLevel.Success.CompareTo(Logtype) == 1)
                {
                    //logtypeid = InvoiceLOGS.InvoiceLogLevel.Success;
                }
                //InvoiceLOGS.InvoiceLogLevel.TryParse(Logtype.ToString(), out logtypeid);
                //InvoiceLOGS.InvoiceLogLevel myval = (InvoiceLOGS.InvoiceLogLevel)Enum.Parse(typeof(TestEnum), Logtype.ToString());

                string[] insert = { logtypeid.ToString(), tranid, paymentmethod.ToString(), issuccess.ToString(), detailmsg, ShortMsg };
                string   cmd    = "INSERT INTO [dbo].[PaymentTransactionLogs] ([LogLevel],[TrnId],[PaymentMethod],[IsSuccess],[ResponseString],[DOC],[ShortMsg])  VALUES  (@1,@2,@3,@4,@5,DATEADD(MINUTE, 330, GETUTCDATE()),@6)";

                int value = dbc.ExecuteQueryWithParams(cmd, insert);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                dbc.closeConnection();
            }
        }
Пример #4
0
 protected void BtnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         string   userId = Request.Cookies["TUser"]["Id"].ToString();
         DateTime dt     = DateTime.Now;
         string[] para1  =
         {
             txtContact.Text.ToString().Replace("'",  "''"),
             txtEmailId.Text.ToString().Replace("'",  "''"),
             txtComments.Text.ToString().Replace("'", "''"),
             dt.ToString(),
             userId
         };
         id = Request.QueryString["Id"];
         if (id != null && !id.Equals(""))
         {
             string queryupdate = "UPDATE [JurisdictionMaster] SET [Contact]=@1,[EmalID]=@2,[Comments]=@3,[ModifiedOn]=@4,[ModifiedBy]=@5 Where JurisdictionID = " + id;
             int    v1          = dbc.ExecuteQueryWithParams(queryupdate, para1);
             if (v1 > 0)
             {
                 sweetMessage("", "Juurisdiction Updated Successfully", "success");
                 Response.Redirect("Jurisdiction.aspx", true);
             }
             else
             {
                 sweetMessage("", "Please Try Again!!", "warning");
             }
         }
     }
     catch (Exception E)
     {
         sweetMessage("", "Please Try Again!!", "warning");
     }
 }
Пример #5
0
 public int InsertIsOffer(int bid, string img, string msg)
 {
     try
     {
         dbConnection dbc     = new dbConnection();
         int          display = 0;
         if (img.Trim().Equals(""))
         {
             display = 0;
         }
         else
         {
             display = 1;
         }
         string[] ins = { img.Trim(), display.ToString(), msg.Trim(), bid.ToString() };
         int      i   = dbc.ExecuteQueryWithParams("insert into Taaza_Offer_Notification (Imageurl,ImageDisplay,OfferStatus,OfferMessage,StartDate,Notification_Id) Values (@1,@2,1,@3,DATEADD(MINUTE, 330, GETUTCDATE()),@4 )", ins);
         if (i > 0)
         {
             return(1);
         }
         else
         {
             return(0);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Пример #6
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string userId     = Request.Cookies["TUser"]["Id"].ToString();
            string categoryId = ddlCategoryName.SelectedValue.ToString();
            int    IsActive   = 0;

            if (chkisactive.Checked)
            {
                IsActive = 1;
            }
            DateTime dt = DateTime.Now;

            if (BtnSave.Text.Equals("Update"))
            {
                string id = Request.QueryString["id"].ToString();

                string[] para1 = { txtSubCategoryName.Text, txtDescription.Text, IsActive.ToString(), dt.ToString(), userId, id, txtSequence.Text, categoryId };

                string query = "UPDATE [tblSubCategory] SET [SubCategory]=@1,[Description]=@2,[IsActive]=@3,[ModifiedOn]=@4,[ModifiedBy]=@5,[sequence]=@7,[CategoryId]=@8 where [Id]=@6";
                int    v1    = dbc.ExecuteQueryWithParams(query, para1);
                if (v1 > 0)
                {
                    sweetMessage("", "SubCategory Updated Successfully", "success");
                    Response.Redirect("SubCategory.aspx", true);
                }
                else
                {
                    sweetMessage("", "Please Try Again!!", "warning");
                }
            }
            else
            {
                string query = "INSERT INTO [dbo].[tblSubCategory] ([SubCategory] ,[Description],[CategoryId],[IsActive],[IsDeleted],[CreatedOn],[CreatedBy],[sequence]) " +
                               " VALUES ('" + txtSubCategoryName.Text.ToString().Replace("'", "''") + "','" + txtDescription.Text.ToString().Replace("'", "''") + "','" + categoryId + "'," + IsActive + ",0,'" + dt.ToString() + "'," + userId + "," + txtSequence.Text + ")";
                int VAL = dbc.ExecuteQuery(query);

                if (VAL > 0)
                {
                    sweetMessage("", "SubCategory Added Successfully", "success");
                    Response.Redirect("SubCategory.aspx", true);
                }
                else
                {
                    sweetMessage("", "Please Try Again!!", "warning");
                }
            }
        }
        catch (Exception E)
        {
            sweetMessage("", "Please Try Again!!", "warning");
        }
    }
Пример #7
0
 protected void Button3_Click(object sender, EventArgs e)
 {
     try
     {
         if (Request.QueryString["Id"] != "" && Request.QueryString["Id"] != null)
         {
             if (!lblTempleteID.Text.Equals(""))
             {
                 try
                 {
                     string[] param          = { txtname.Text, txtSubject.Text, txtFullDescription.Text, chkisActive.Checked ? "1" : "0", "0", cmbMailAccount.Value, "0", "1", lblTempleteID.Text };
                     string   updateTemplete = @"UPDATE  [MessageTemplate] SET [Name] = @1 ,[Subject] = @2 ,[Body] = @3   ,[IsActive] =@4 ,[AttachedDownloadId] = @5 ,[EmailAccountId] =@6 ,[LimitedToStores] = @7,[Priority] = @8 WHERE Id=@9";
                     dbCon.ExecuteQueryWithParams(updateTemplete, param);
                 }
                 catch (Exception)
                 {
                 }
             }
         }
         else
         {
             try
             {
                 string[] param         = { txtname.Text, txtSubject.Text, txtFullDescription.Text, chkisActive.Checked ? "1" : "0", "0", cmbMailAccount.Value, "0", "1" };
                 string   insertTemplet = @"INSERT INTO  [MessageTemplate] ([Name],[Subject],[Body],[IsActive],[AttachedDownloadId],[EmailAccountId],[LimitedToStores],[Priority]) VALUES(@1,@2,@3,@4,@5,@6,@7,@8)";
                 int      v             = dbCon.ExecuteQueryWithParams(insertTemplet, param);
             }
             catch (Exception)
             {
             }
         }
     }
     catch (Exception)
     {
     }
 }
Пример #8
0
        public double SendNotificationEmail(string subject, string body, string Priority, string From, string FromName, string To, string ToName, string EmailAccountId)
        {
            dbConnection dbc         = new dbConnection();
            string       InsertEmail = "";
            int          rest        = 0;

            try
            {
                InsertEmail = "INSERT INTO dbo.QueuedEmail([Priority],[From],FromName,[To],ToName,[Subject],Body,CreatedOnUtc,EmailAccountId,AttachedDownloadId,SentTries,isSent,inProcess,AttachmentFileName,AttachmentFilePath) VALUES(@1,@2,@3,@4,@5,@6,@7,GETUTCDATE(),@8,0,0,0,0,@9,@10)";
                string[] parm = { Priority, From, FromName, To, ToName, subject, body, EmailAccountId, "", "" };
                rest = dbc.ExecuteQueryWithParams(InsertEmail, parm);
            }
            catch (Exception err)
            {
                //Logger.InsertLogs(InvoiceLOGS.InvoiceLogLevel.Error, InsertEmail, 0, false, "1.Qued Email Customer", " ");
            }
            return(rest);
        }
Пример #9
0
        public static void InsertLogsApp(String detailmsg)
        {
            dbConnection dbc = new dbConnection();

            try
            {
                string[] insert = { detailmsg };
                string   cmd    = "INSERT INTO [dbo].[ErrorLogs] ([Detail],[DOC]) VALUES  (@1,DATEADD(MINUTE, 330, GETUTCDATE()))";

                int value = dbc.ExecuteQueryWithParams(cmd, insert);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                dbc.closeConnection();
            }
        }
Пример #10
0
    protected void Save_Click(object sender, EventArgs e)
    {
        Customerid = clsCommon.getCurrentCustomer().id;
        string fname = txtfname.Text;
        string lname = txtlname.Text;
        string email = txtemail.Text;

        string cityid = (ddlcity.SelectedValue).ToString();


        //string cityid = ddlcity.SelectedItem.ToString();
        string stateid = (ddlstate.SelectedValue).ToString();

        String querynew = "UPDATE [dbo].[Customer] SET [FirstName] = @1 ,[LastName]= @2,[Email] = @3 ,[CityId]=@4 ,[StateId]=@5 WHERE [Id] =  '" + Customerid + "'";

        string[] parms_new = { fname, lname, email, cityid, stateid };
        int      resvaltrn = dbc.ExecuteQueryWithParams(querynew, parms_new);

        if (resvaltrn > 0)
        {
            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();
            }

            edittable.Visible   = false;
            editsection.Visible = true;
        }
    }
Пример #11
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string userId    = Request.Cookies["TUser"]["Id"].ToString();
            int    IsActive  = 0;
            string id1       = Request.QueryString["Id"];
            string startdate = txtdt.Text.ToString();
            string starttime = txttime.Text.ToString();
            string enddate   = txtdt1.Text.ToString();
            string endtime   = txttime1.Text.ToString();

            string FROM1 = startdate + " " + starttime;
            string TO1   = enddate + " " + endtime;

            string[]     validFileTypes = { "png", "jpg", "jpeg" };
            Stream       fs             = FileUpload1.PostedFile.InputStream;
            BinaryReader br             = new BinaryReader(fs);
            Byte[]       image          = br.ReadBytes((Int32)fs.Length);

            string exten = System.IO.Path.GetExtension(FileUpload1.FileName);
            string name  = System.IO.Path.GetFileName(FileUpload1.FileName);

            string ext = System.IO.Path.GetExtension(FileUpload1.FileName);

            bool   isValidFile = false;
            string imgname = "", imgnamenew = "";
            if (FileUpload1.HasFile)
            {
                for (int i = 0; i < validFileTypes.Length; i++)
                {
                    if (ext == "." + validFileTypes[i])
                    {
                        isValidFile = true;
                        break;
                    }
                    else
                    {
                        //lblmsg.Text = "Line : 349 : " + aa.Message;
                    }
                }

                if (!isValidFile)
                {
                    return;
                }


                ext = ext.Replace(".", "images/");

                imgname    = DateTime.Now.Ticks + exten;
                imgnamenew = FileUpload1.FileName;
                string path = Server.MapPath("/BannerImage");
                FileUpload1.SaveAs(path + "/" + imgnamenew);
            }

            string fileName = "";
            fileName = imgnamenew;


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

            string sCategoryId = "";
            if (string.IsNullOrEmpty(ddlbasicCategory.SelectedValue))
            {
                sCategoryId = "0";
            }
            else
            {
                sCategoryId = ddlbasicCategory.SelectedValue.ToString();
            }

            string sProductId = "";
            if (string.IsNullOrEmpty(txtpname.Text))
            {
                sProductId = "0";
            }
            else
            {
                string    productQry = " SELECT ID From Product WHERE Name = '" + txtpname.Text + "' AND IsDeleted=0  AND IsActive = 1";
                DataTable dtProduct  = dbc.GetDataTable(productQry);
                if (dtProduct.Rows.Count > 0)
                {
                    sProductId = dtProduct.Rows[0]["ID"].ToString();
                }
            }
            //sProductId = ddlbasicProduct.SelectedValue.ToString();
            if (sProductId == "")
            {
                sweetMessage("", "Please select product from given list", "warning");
            }
            else
            {
                int sActionId = 0;
                if (Convert.ToInt32(ddlbasicAction.SelectedValue) != 0)
                {
                    sActionId = Convert.ToInt32(ddlbasicAction.SelectedValue);
                }

                List <ListItem> selectedIncharge = new List <ListItem>();
                selectedIncharge = chklstBasicJurisdictionIncharge.Items.Cast <ListItem>().Where(n => n.Selected).ToList();

                List <ListItem> selectedCategory = new List <ListItem>();
                selectedCategory = chklstCategory.Items.Cast <ListItem>().Where(n => n.Selected).ToList();

                if (BtnSave.Text.Equals("Update"))
                {
                    string id = Request.QueryString["id"].ToString();
                    if (ddlBannerType.SelectedValue == "1")
                    {
                        string delJurisdictionBanner = " Delete FROM [dbo].[JurisdictionBanner]  where BannerType = 'HomePage' AND BannerId=" + Convert.ToInt32(id);
                        dbc.ExecuteQuery(delJurisdictionBanner);

                        string delCategoryBannerLink = " Delete FROM [dbo].[tblCategoryBannerLink]  where BannerType='HomePage' AND BannerId=" + Convert.ToInt32(id);
                        dbc.ExecuteQuery(delCategoryBannerLink);

                        if (fileName != "")
                        {
                            string[] para1 = { txtTitle1.Text, txtAltText.Text, txtbasicLink.Text, FROM1, TO1, IsActive.ToString(), fileName, dbc.getindiantime().ToString("dd-MMM-yyyy HH:mm:ss"), sCategoryId, sProductId, sActionId.ToString(), txtSequence.Text, id1 };
                            string   query = "UPDATE [HomepageBanner] SET [Title]=@1,[AltText]=@2,[Link]=@3,[StartDate]=@4," +
                                             " [EndDate]=@5,[IsActive]=@6,[ImageName]=@7,[DOM]=@8,[CategoryId]=@9,[ProductId]=@10, [ActionId]=@11, [sequence]=@12 where [Id]=@13";
                            int v1 = dbc.ExecuteQueryWithParams(query, para1);
                            if (v1 > 0)
                            {
                                foreach (ListItem item in selectedIncharge)
                                {
                                    string sJurisdictionId = item.Value.ToString();

                                    string Jurisdictionquery = "INSERT INTO [dbo].[JurisdictionBanner] ([JurisdictionId] ,[BannerId],[CreatedOn],[CreatedBy],[BannerType])";
                                    Jurisdictionquery += " VALUES ('" + sJurisdictionId + "','" + id + "','" + dbc.getindiantimeString() + "'," + userId + ",'HomePage')";
                                    dbc.ExecuteQuery(Jurisdictionquery);
                                }
                                foreach (ListItem item in selectedCategory)
                                {
                                    string cCategoryId = item.Value.ToString();
                                    if (cCategoryId != "0")
                                    {
                                        string Categoryquery = "INSERT INTO [dbo].[tblCategoryBannerLink] ([CategoryId],[BannerId],[CreatedDate],[CreatedBy],[IsActive],[BannerType])";
                                        Categoryquery += " VALUES ('" + cCategoryId + "','" + id + "','" + dbc.getindiantimeString() + "'," + userId + ",1," + "'HomePage')";
                                        dbc.ExecuteQuery(Categoryquery);
                                    }
                                }
                                sweetMessage("", "Banner Updated Successfully", "success");
                                Response.Redirect("HomePageBannerList.aspx", true);
                            }
                        }
                        else if (fileName == "")
                        {
                            string[] para1 = { txtTitle1.Text, txtAltText.Text, txtbasicLink.Text, FROM1, TO1, IsActive.ToString(), dbc.getindiantime().ToString("dd-MMM-yyyy HH:mm:ss"), sCategoryId, sProductId, sActionId.ToString(), txtSequence.Text, id1 };

                            string query = "UPDATE [HomepageBanner] SET [Title]=@1,[AltText]=@2,[Link]=@3,[StartDate]=@4," +
                                           " [EndDate]=@5,[IsActive]=@6,[DOM]=@7,[CategoryId]=@8,[ProductId]=@9, [ActionId]=@10,[sequence]=@11 where [Id]=@12";
                            int v1 = dbc.ExecuteQueryWithParams(query, para1);
                            if (v1 > 0)
                            {
                                foreach (ListItem item in selectedIncharge)
                                {
                                    string sJurisdictionId = item.Value.ToString();

                                    string Jurisdictionquery = "INSERT INTO [dbo].[JurisdictionBanner] ([JurisdictionId] ,[BannerId],[CreatedOn],[CreatedBy],[BannerType])";
                                    Jurisdictionquery += " VALUES ('" + sJurisdictionId + "','" + id + "','" + dbc.getindiantimeString() + "'," + userId + ",'HomePage')";
                                    dbc.ExecuteQuery(Jurisdictionquery);
                                }
                                foreach (ListItem item in selectedCategory)
                                {
                                    string cCategoryId = item.Value.ToString();
                                    if (cCategoryId != "0")
                                    {
                                        string Categoryquery = "INSERT INTO [dbo].[tblCategoryBannerLink] ([CategoryId],[BannerId],[CreatedDate],[CreatedBy],[IsActive],[BannerType])";
                                        Categoryquery += " VALUES ('" + cCategoryId + "','" + id + "','" + dbc.getindiantimeString() + "'," + userId + ",1," + "'HomePage')";
                                        dbc.ExecuteQuery(Categoryquery);
                                    }
                                }
                                sweetMessage("", "Banner Updated Successfully", "success");
                                Response.Redirect("HomePageBannerList.aspx", true);
                            }
                            else
                            {
                                sweetMessage("", "Please Try Again!!", "warning");
                            }
                        }
                    }
                    else
                    {
                        string delJurisdictionBanner = " Delete FROM [dbo].[JurisdictionBanner]  where BannerType='Intermediate' AND BannerId=" + Convert.ToInt32(id);
                        dbc.ExecuteQuery(delJurisdictionBanner);

                        string delCategoryBannerLink = " Delete FROM [dbo].[tblCategoryBannerLink]  where BannerType='Intermediate' AND BannerId=" + Convert.ToInt32(id);
                        dbc.ExecuteQuery(delCategoryBannerLink);

                        if (fileName != "")
                        {
                            string[] para1 = { txtTitle1.Text, txtAltText.Text, txtbasicLink.Text, FROM1, TO1, IsActive.ToString(), fileName, dbc.getindiantimeString(), userId, sCategoryId, sActionId.ToString(), sProductId, txtSequence.Text, id1 };
                            string   query = "UPDATE [IntermediateBanners] SET [Title]=@1,[AltText]=@2,[Link]=@3,[StartDate]=@4,[EndDate]=@5,[IsActive]=@6,[ImageName]=@7,[ModifiedOn]=@8,[ModifiedBy]=@9," +
                                             " [CategoryID]=@10,[ActionId]=@11,[ProductId]=@12, [sequence]=@13" +
                                             " where [Id]=@14";
                            int v1 = dbc.ExecuteQueryWithParams(query, para1);
                            if (v1 > 0)
                            {
                                foreach (ListItem item in selectedIncharge)
                                {
                                    string sJurisdictionId = item.Value.ToString();

                                    string Jurisdictionquery = "INSERT INTO [dbo].[JurisdictionBanner] ([JurisdictionId] ,[BannerId],[CreatedOn],[CreatedBy],[BannerType])";
                                    Jurisdictionquery += " VALUES ('" + sJurisdictionId + "','" + id1 + "','" + dbc.getindiantimeString() + "'," + userId + ",'Intermediate')";
                                    dbc.ExecuteQuery(Jurisdictionquery);
                                }

                                foreach (ListItem item in selectedCategory)
                                {
                                    string cCategoryId = item.Value.ToString();
                                    if (cCategoryId != "0")
                                    {
                                        string Categoryquery = "INSERT INTO [dbo].[tblCategoryBannerLink] ([CategoryId],[BannerId],[CreatedDate],[CreatedBy],[IsActive],[BannerType])";
                                        Categoryquery += " VALUES ('" + cCategoryId + "','" + id1 + "','" + dbc.getindiantimeString() + "'," + userId + ",1," + "'Intermediate')";
                                        dbc.ExecuteQuery(Categoryquery);
                                    }
                                }
                                sweetMessage("", "Intermediate Updated Successfully", "success");
                                Response.Redirect("HomePageBannerList.aspx", true);
                            }
                        }
                        else if (fileName == "")
                        {
                            string[] para1 = { txtTitle1.Text, txtAltText.Text, txtbasicLink.Text, FROM1, TO1, IsActive.ToString(), dbc.getindiantimeString(), userId, sCategoryId, sActionId.ToString(), sProductId, txtSequence.Text, id1 };

                            string query = "UPDATE [IntermediateBanners] SET [Title]=@1,[AltText]=@2,[Link]=@3,[StartDate]=@4,[EndDate]=@5,[IsActive]=@6,[ModifiedOn]=@7,[ModifiedBy]=@8, " +
                                           " [CategoryID]=@9,[ActionId]=@10,[ProductId]=@11, [sequence]=@12" +
                                           " where[Id] =@13";
                            int v1 = dbc.ExecuteQueryWithParams(query, para1);
                            if (v1 > 0)
                            {
                                foreach (ListItem item in selectedIncharge)
                                {
                                    string sJurisdictionId = item.Value.ToString();

                                    string Jurisdictionquery = "INSERT INTO [dbo].[JurisdictionBanner] ([JurisdictionId] ,[BannerId],[CreatedOn],[CreatedBy],[BannerType])";
                                    Jurisdictionquery += " VALUES ('" + sJurisdictionId + "','" + id1 + "','" + dbc.getindiantimeString() + "'," + userId + ",'Intermediate')";
                                    dbc.ExecuteQuery(Jurisdictionquery);
                                }

                                foreach (ListItem item in selectedCategory)
                                {
                                    string cCategoryId = item.Value.ToString();
                                    if (cCategoryId != "0")
                                    {
                                        string Categoryquery = "INSERT INTO [dbo].[tblCategoryBannerLink] ([CategoryId],[BannerId],[CreatedDate],[CreatedBy],[IsActive],[BannerType])";
                                        Categoryquery += " VALUES ('" + cCategoryId + "','" + id1 + "','" + dbc.getindiantimeString() + "'," + userId + ",1," + "'Intermediate')";
                                        dbc.ExecuteQuery(Categoryquery);
                                    }
                                }
                                sweetMessage("", "Intermediate Banner Updated Successfully", "success");
                                Response.Redirect("HomePageBannerList.aspx", true);
                            }
                            else
                            {
                                sweetMessage("", "Please Try Again!!", "warning");
                            }
                        }
                    }
                }
                else
                {
                    if (ddlBannerType.SelectedValue == "1")
                    {
                        string[] para1 = { txtTitle1.Text.ToString().Replace("'",    "''"),
                                           txtAltText.Text.ToString().Replace("'",   "''"),
                                           txtbasicLink.Text.ToString().Replace("'", "''"),
                                           FROM1,
                                           TO1,
                                           IsActive.ToString(),
                                           fileName,
                                           "0",
                                           dbc.getindiantimeString(),
                                           dbc.getindiantimeString(),
                                           sActionId.ToString(),
                                           sCategoryId,
                                           sProductId,
                                           txtSequence.Text };
                        //string query = "INSERT INTO [dbo].[HomepageBanner] ([Title] ,[AltText],[Link],[StartDate],[EndDate],[IsActive],[ImageName],[IsDeleted],[DOC],[DOM],[ActionId],[CategoryId],[ProductId]) VALUES ('" + txtTitle1.Text + "','" + txtAltText.Text + "','" + txtbasicLink.Text + "','" + FROM1 + "','" + TO1 + "','" + IsActive + "','" + fileName + "',0,'" + dbc.getindiantimeString() + "','" + dbc.getindiantimeString() + "',"+sActionId+","+sCategoryId+","+sProductId+")";
                        string query = "INSERT INTO [dbo].[HomepageBanner] ([Title] ,[AltText],[Link],[StartDate],[EndDate]," +
                                       " [IsActive],[ImageName],[IsDeleted],[DOC],[DOM],[ActionId],[CategoryId],[ProductId],[sequence])" +
                                       " VALUES (@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11,@12,@13,@14); SELECT SCOPE_IDENTITY();";
                        //int VAL = dbc.ExecuteQuery(query);
                        int VAL = dbc.ExecuteQueryWithParamsId(query, para1);
                        if (VAL > 0)
                        {
                            foreach (ListItem item in selectedIncharge)
                            {
                                string sJurisdictionId = item.Value.ToString();

                                string Jurisdictionquery = "INSERT INTO [dbo].[JurisdictionBanner] ([JurisdictionId] ,[BannerId],[CreatedOn],[CreatedBy],[BannerType])";
                                Jurisdictionquery += " VALUES ('" + sJurisdictionId + "','" + VAL + "','" + dbc.getindiantimeString() + "'," + userId + ",'HomePage')";
                                dbc.ExecuteQuery(Jurisdictionquery);
                            }
                            foreach (ListItem item in selectedCategory)
                            {
                                string cCategoryId = item.Value.ToString();
                                if (cCategoryId != "0")
                                {
                                    string Categoryquery = "INSERT INTO [dbo].[tblCategoryBannerLink] ([CategoryId],[BannerId],[CreatedDate],[CreatedBy],[IsActive],[BannerType])";
                                    Categoryquery += " VALUES ('" + cCategoryId + "','" + VAL + "','" + dbc.getindiantimeString() + "'," + userId + ",1" + ",'HomePage')";
                                    dbc.ExecuteQuery(Categoryquery);
                                }
                            }
                            sweetMessage("", "Banner Uploaded Successfully", "success");
                            Response.Redirect("HomePageBannerList.aspx", true);
                        }
                        else
                        {
                            sweetMessage("", "Please Try Again!!", "warning");
                        }
                    }
                    else
                    {
                        string[] para1 = { txtTitle1.Text.ToString().Replace("'",    "''"),
                                           txtAltText.Text.ToString().Replace("'",   "''"),
                                           txtbasicLink.Text.ToString().Replace("'", "''"),
                                           FROM1,
                                           TO1,
                                           IsActive.ToString(),
                                           fileName,
                                           "0",
                                           ddlBannerType.SelectedValue,
                                           dbc.getindiantimeString(),
                                           userId,
                                           ddlbasicAction.SelectedItem.ToString(),
                                           sCategoryId,
                                           sActionId.ToString(),
                                           sProductId,
                                           txtSequence.Text };

                        string query = "INSERT INTO [dbo].[IntermediateBanners] ([Title] ,[AltText],[Link],[StartDate],[EndDate],[IsActive],[ImageName],";
                        query += "[IsDeleted],[TypeId],[CreatedOn],[CreatedBy],[Action],[CategoryID],[ActionId],[ProductId],[sequence]) VALUES (@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11,@12,@13,@14,@15,@16); SELECT SCOPE_IDENTITY();";
                        //query +=  ddlintermediateType.SelectedValue.ToString() + "','" + dtCreatedon.ToString() + "'," + userId + ",'" + ddlintermedicateAction.SelectedItem.ToString() + "'," + sCategoryId + "," + intermediateActionId + "," + sProductId + "); SELECT SCOPE_IDENTITY();";
                        //int VAL = dbc.ExecuteQuery(query);
                        int VAL = dbc.ExecuteQueryWithParamsId(query, para1);
                        //query += "','" + FROM1 + "','" + TO1 + "','" + IsActive + "','" + fileName + "',0,'";


                        if (VAL > 0)
                        {
                            foreach (ListItem item in selectedIncharge)
                            {
                                string sJurisdictionId = item.Value.ToString();

                                string Jurisdictionquery = "INSERT INTO [dbo].[JurisdictionBanner] ([JurisdictionId] ,[BannerId],[CreatedOn],[CreatedBy],[BannerType])";
                                Jurisdictionquery += " VALUES ('" + sJurisdictionId + "','" + VAL + "','" + dbc.getindiantimeString() + "'," + userId + ",'Intermediate')";
                                dbc.ExecuteQuery(Jurisdictionquery);
                            }
                            foreach (ListItem item in selectedCategory)
                            {
                                string cCategoryId = item.Value.ToString();

                                string Categoryquery = "INSERT INTO [dbo].[tblCategoryBannerLink] ([CategoryId],[BannerId],[CreatedDate],[CreatedBy],[IsActive],[BannerType])";
                                Categoryquery += " VALUES ('" + cCategoryId + "','" + VAL + "','" + dbc.getindiantimeString() + "'," + userId + ",1" + ",'Intermediate')";
                                dbc.ExecuteQuery(Categoryquery);
                            }
                            sweetMessage("", "Intermediate Banner Added Successfully", "success");
                            Response.Redirect("HomePageBannerList.aspx", true);
                        }
                        else
                        {
                            sweetMessage("", "Please Try Again!!", "warning");
                        }
                    }
                }
            }
        }
        catch (Exception E)
        {
            sweetMessage("", "Please Try Again!!", "warning");
        }
    }
    public int StoreNotificationScheduler(string NotificationTo, string SendTo, string Category, string Product, string Message, string MobileNumber, string NotificationType, string ScheduleTime, string exptime, string ImageUrl)
    {
        try
        {
            //string NotificationType = "15";

            int userId = 0;
            int.TryParse(Request.Cookies["TUser"]["Id"], out userId);

            string   ScheduleQuery = "INSERT INTO [dbo].[Sosho_Notification_Schedule] ([NotificationTo],[SendTo],[CategoryId],[ProductId],[ImageUrl],[Message],[NotificationType],[IsSend],[DOC],[DOM],[ExpiredTime],[SendBy],[ScheduleTime],DisplayExpiredTime) VALUES(@1,@2,@3,@4,@5,@6,@7,@8,CONVERT(DATETIME, '" + dbc.getDOCMtime() + "', 102),CONVERT(DATETIME, '" + dbc.getDOCMtime() + "', 102),CONVERT(DATETIME, '" + dbc.getindiantime().AddHours(24).ToString("yyyy-MM-dd HH:mm:ss") + "', 102),@9,'" + ScheduleTime + "','" + exptime + "')";
            string[] parm          = { NotificationTo, SendTo, "0", Product, ImageUrl, Message, Category, "0", userId.ToString() };
            int      rest          = dbc.ExecuteQueryWithParams(ScheduleQuery, parm);
            if (rest > 0)
            {
                string qs2 = "SELECT IDENT_CURRENT('Sosho_Notification_Schedule')";

                object objbid = dbc.ExecuteSQLScaler(qs2);

                int scheduleId = 0;
                int.TryParse(objbid.ToString(), out scheduleId);


                if (scheduleId > 0)
                {
                    if (SendTo.Equals("1"))
                    {
                        string    MobileQuery = "select *,iif(IsIOS = 1,1,0) as DeviceType from (select isnull(deviceid,'') as deviceid, isnull(fcmregistrationid,'') as fcmregistrationid, mobilenumber, [doc], dom, Id, IsIOS, (select top 1 isnull(Id,0) from Customer where Mobile = mobilenumber) as CustomerId from [dbo].[DevicedetailsCustomer] where mobilenumber in (" + MobileNumber + ")) as finalData where CustomerId <> 0 AND deviceid <> '' AND fcmregistrationid <> '' Order by mobilenumber";
                        DataTable dtMob       = dbc.GetDataTable(MobileQuery);

                        if (dtMob.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtMob.Rows.Count; i++)
                            {
                                string InertScheduleDetail = "INSERT INTO [dbo].[Sosho_Notification_Schedule_Detail] ([ScheduleID],[DeviceId],[FCMRegistrationId],[Message],[ResponseId],[Type],[DOC],[Mobile],[isSend],[isSuccess],[delivered],[opentime],[DeviceType],[CustomerId],[ExpiredTime]) VALUES (@1,@2,@3,@4,'',@5,CONVERT(DATETIME, '" + dbc.getDOCMtime() + "', 102),@6,0,0,'','',@7,@8,@9)";

                                string[] parmdata = { scheduleId.ToString(), dtMob.Rows[i]["deviceid"].ToString(), dtMob.Rows[i]["fcmregistrationid"].ToString(), Message, NotificationType, dtMob.Rows[i]["mobilenumber"].ToString(), dtMob.Rows[i]["DeviceType"].ToString(), dtMob.Rows[i]["CustomerId"].ToString(), exptime };

                                int restdet = dbc.ExecuteQueryWithParams(InertScheduleDetail, parmdata);
                            }
                            return(1);
                        }
                        else
                        {
                            return(0);
                        }
                    }
                    else
                    {
                        return(1); // Send To All Mobile Details Store Via Scheduler
                    }
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }
        catch (Exception ex)
        {
            return(-1);
        }
    }
Пример #13
0
    protected void cmdSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (Request.QueryString.AllKeys.Contains("ID"))
            {
                if (!Request.QueryString["ID"].ToString().Equals(""))
                {
                    if (txtusername.Text.Trim() != "" && txtpwd.Text.Trim() != "" && txtnumber.Text.Trim() != "")
                    {
                        DataTable dtcheck = dbc.GetDataTable("select * from Users where UserName = '******' and id <> " + Request.QueryString["ID"].ToString() + "");
                        if (dtcheck.Rows.Count > 0)
                        {
                            ltrErr.Text = "Username already exist, Please use different username.";
                            return;
                        }
                        string[] ins = { txtusername.Text.Trim(), txtpwd.Text.Trim(), txtnumber.Text.Trim() };
                        int      i   = dbc.ExecuteQueryWithParams("update Users set Username=@1,Password=@2,mobile_number=@3 where id=" + Request.QueryString["ID"].ToString() + "", ins);
                        if (i > 0)
                        {
                            Response.Redirect("~/RoleManagement/User.aspx", false);
                        }
                    }
                    else
                    {
                        getdata();
                        ltrErr.Text = "Please fill all details";
                    }
                }
            }
            else
            {
                if (txtusername.Text.Trim() != "" && txtpwd.Text.Trim() != "" && txtnumber.Text.Trim() != "")
                {
                    DataTable dtcheck = dbc.GetDataTable("select * from Users where UserName = '******' ");
                    if (dtcheck.Rows.Count > 0)
                    {
                        ltrErr.Text = "Username already exist, Please use different username.";
                        return;
                    }
                    string[] ins = { txtusername.Text.Trim(), txtpwd.Text.Trim(), txtnumber.Text.Trim() };
                    int      i   = dbc.ExecuteQueryWithParams("insert into Users (Username,Password,mobile_number) values(@1,@2,@3)", ins);
                    if (i > 0)
                    {
                        getdata();
                        ltrErr.Text      = "Inserted Successfully";
                        txtusername.Text = "";
                        txtpwd.Text      = "";
                        txtnumber.Text   = "";
                    }

                    else
                    {
                        getdata();
                        ltrErr.Text = "Not Inserted";
                    }
                }
                else
                {
                    getdata();
                    ltrErr.Text = "Please fill all details";
                }
            }
        }
        catch (Exception ex)
        {
            ltrErr.Text = ex.Message;
        }
    }
Пример #14
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string userId   = Request.Cookies["TUser"]["Id"].ToString();
            int    IsActive = 0;

            DateTime dt = DateTime.Now;
            if (chkisactive.Checked)
            {
                IsActive = 1;
            }

            string[] para1 = { txtJurisdictionIncharge.Text.ToString().Replace("'", "''"),
                               txtContact.Text.ToString().Replace("'",              "''"),
                               txtEmailId.Text.ToString().Replace("'",              "''"),
                               ddlState.SelectedItem.Value,
                               ddlCity.SelectedItem.Value,
                               txtComments.Text.ToString().Replace("'",             "''"),
                               IsActive.ToString(),
                               dt.ToString(),
                               userId };

            if (BtnSave.Text.Equals("Update"))
            {
                string id    = Request.QueryString["id"].ToString();
                string query = " UPDATE [JurisdictionMaster] SET [JurisdictionIncharge]=@1,[Contact]=@2,[EmalID]=@3,[StateId]=@4,[CityId]=@5,[Comments]=@6, " +
                               " [IsActive] = @7,[CreatedOn] = @8,[CreatedBy] = @9 WHERE JurisdictionID = " + id;
                int v1 = dbc.ExecuteQueryWithParams(query, para1);
                if (v1 > 0)
                {
                    string updateUser = "******" + txtUserName.Text.ToString() + "',[Password]='" + txtPassword.Text.ToString() + "'," +
                                        " [Name]='" + txtUserName.Text.ToString() + "',[UserType]=2,[JurisdictionID]=" + id + ",[Mobile] = '" + txtContact.Text.ToString() + "'" +
                                        " WHERE JurisdictionID = " + id;
                    int userVAL = dbc.ExecuteQuery(updateUser);
                    sweetMessage("", "Jurisdiction Updated Successfully", "success");
                    Response.Redirect("Jurisdiction.aspx");
                }
            }
            else
            {
                string query1 = "INSERT INTO [JurisdictionMaster] ([JurisdictionIncharge],[Contact],[EmalID],[StateId],[CityId],[Comments],[IsActive],[CreatedOn],[CreatedBy]) VALUES (@1,@2,@3,@4,@5,@6,@7,@8,@9); SELECT SCOPE_IDENTITY();";
                int    VAL    = dbc.ExecuteQueryWithParamsId(query1, para1);

                if (VAL > 0)
                {
                    string          InsertJDetailqry = "";
                    List <ListItem> selectedPincode  = new List <ListItem>();
                    selectedPincode = chklstPincode.Items.Cast <ListItem>().Where(n => n.Selected).ToList();
                    foreach (ListItem item in selectedPincode)
                    {
                        InsertJDetailqry = "INSERT INTO [JurisdictionDetail] ([JurisdictionID],[PinCodeID],[IsActive],[CreatedOn],[CreatedBy]) VALUES ('" + VAL + "','" + item + "'," + IsActive + ",'" + dt + "'," + userId + ")";
                        int VAL1 = dbc.ExecuteQuery(InsertJDetailqry);
                    }
                    if (Convert.ToInt32(VAL) > 0)
                    {
                        hdnJurisdictionID.Value = VAL.ToString();
                        hdnContact.Value        = txtContact.Text.ToString().Replace("'", "''");
                        string InsertUserqry = "INSERT INTO [Users] ([UserName],[Password],[Name],[UserType],[JurisdictionID],[Mobile]) VALUES ('" + txtUserName.Text.ToString().Replace("'", "''") + "','" + txtPassword.Text.ToString().Replace("'", "''") + "','" + txtUserName.Text.ToString().Replace("'", "''") + "',2," + VAL.ToString() + "," + txtContact.Text.ToString() + ")";
                        int    userVAL       = dbc.ExecuteQuery(InsertUserqry);
                        sweetMessage("", "Jurisdiction Added Successfully", "success");
                        Response.Redirect("Jurisdiction.aspx");
                    }
                    else
                    {
                        hdnJurisdictionID.Value = "0";
                        sweetMessage("", "Please Try Again!!", "warning");
                    }
                }
                else
                {
                    sweetMessage("", "Please Try Again!!", "warning");
                }
            }
            //string InsertJurisdictionMasterqry = "INSERT INTO [JurisdictionMaster] ([JurisdictionIncharge],[Contact],[EmalID],[StateId],[CityId],[Comments],[IsActive],[CreatedOn],[CreatedBy]) VALUES ('" + txtJurisdictionIncharge.Text.ToString().Replace("'", "''") + "','" + txtContact.Text.ToString().Replace("'", "''") + "','" + txtEmailId.Text.ToString().Replace("'", "''") + "'," + ddlState.SelectedItem.Value + "," + ddlCity.SelectedItem.Value + ",'" + txtComments.Text.ToString().Replace("'", "''") + "'," + IsActive + ",'" + dt + "'," + userId + ")";
            //int VAL = dbc.ExecuteQuery(InsertJurisdictionMasterqry);
        }
        catch (Exception E)
        {
            sweetMessage("", "Please Try Again!!", "warning");
        }
    }
Пример #15
0
         public PlaceOrderModel PlaceOrder(String CustomerId, decimal PaidAmount, string AddressId, string Quantity, string buywith, string discountamount = "", string Redeemeamount = "", string couponCode = "")
         {
               PlaceOrderModel objplaceorder = new PlaceOrderModel();
               try
               {
                   string merchantTxnId = dbCon.getindiantime().ToString("yyyyMMddHHmmssffff") + CustomerId;
                   if(PaidAmount==0)
                   {
                       int result = dbCon.CreateTransaction(merchantTxnId, CustomerId, PaidAmount);
                       if (result == 1)
                       {
                           string chektrans = "select id from AlterNetOrder where trnid=@1";
                           string[] param = { merchantTxnId };
                           DataTable dtcheckTrans = dbCon.GetDataTableWithParams(chektrans, param);
                           if (dtcheckTrans != null && dtcheckTrans.Rows.Count > 0)
                           {
                               dbCon.deleteAlternateOrder(merchantTxnId);
                           }
                           else
                           {
                               int chkalternat = CreateAlternateOrder(CustomerId, merchantTxnId, AddressId, PaidAmount.ToString(), Quantity, buywith, discountamount, Redeemeamount, couponCode);
                               if (chkalternat > 0 && PaidAmount == 0)
                               {
                                   int OrderId = WalletPlaceOrder(merchantTxnId);
                                   if (OrderId > 0)
                                   {
                                       // if success, Update the transaction 
                                       #region Update Transaction
                                       try
                                       {
                                           String querynew = "UPDATE [dbo].[CitrusPayment] SET [OrderId] = @1 ,[Order_TimeOfTransaction]= @2,[Statuse] = @3 ,[IsPaymentSuccess]=@4 WHERE [TxnId] =  '" + merchantTxnId + "'";
                                           string[] parms_new = { OrderId.ToString(), dbCon.getindiantime().ToString("dd/MMM/yyyy HH:mm:ss"), "3", "1" };
                                           int resvaltrn = dbCon.ExecuteQueryWithParams(querynew, parms_new);
                                           if (resvaltrn > 0)
                                           {
                                               String querynew1 = "UPDATE [dbo].[AlternetOrder] SET [UpdatedOnUtc]=@1,[IsPaymentDone]=@2 WHERE [TrnId] =  '" + merchantTxnId + "'";
                                               string[] parms_new1 = { dbCon.getindiantime().ToString("dd/MMM/yyyy HH:mm:ss"), "1" };

                                               int resvaltrn1 = dbCon.ExecuteQueryWithParams(querynew1, parms_new1);
                                               if (resvaltrn1 > 0)
                                               {
                                                   String querynew2 = "UPDATE [dbo].[Order] SET [UpdatedOnUtc] =@1,[IsPaymentDone]=@2 WHERE [TRNID] ='" + merchantTxnId + "'";
                                                   string[] parms_new2 = { dbCon.getindiantime().ToString("dd/MMM/yyyy HH:mm:ss"), "1" };

                                                   int resvaltrn2 = dbCon.ExecuteQueryWithParams(querynew2, parms_new2);
                                                   if (resvaltrn2 > 0)
                                                   {
                                                       objplaceorder.resultflag = "1";
                                                       objplaceorder.OrderId = OrderId.ToString();
                                                       objplaceorder.Message = "Your OrderNo:" + OrderId + " has been succesfully generated";
                                                   }
                                               }
                                           }
                                           else
                                           {
                                               objplaceorder.resultflag = "1";
                                               objplaceorder.OrderId = OrderId.ToString();
                                               objplaceorder.Message = "Your Order was Not Generated";
                                           }
                                       }
                                       catch (Exception err)
                                       {
                                           objplaceorder.resultflag = "1";
                                           objplaceorder.OrderId = OrderId.ToString();
                                           objplaceorder.Message = "Your Order was Not Generated";
                                       }
                                       #endregion
                                   }
                                   else
                                   {
                                       objplaceorder.resultflag = "1";
                                       objplaceorder.OrderId = OrderId.ToString();
                                       objplaceorder.Message = "Your Order was Not Generated";
                                   }

                               }
                               else
                               {
                                   objplaceorder.resultflag = "0";
                                   objplaceorder.Message = "Your Order was Not Generated";
                               }

                           }
                       }
                   }

               }
               catch(Exception ex)
               {

               }
               return objplaceorder;
         }
Пример #16
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string userId   = Request.Cookies["TUser"]["Id"].ToString();
            int    IsActive = 0;
            string id1      = Request.QueryString["Id"];

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

            string sSuperFranchiseeId = "";
            if (string.IsNullOrEmpty(ddlSuperFranchisee.SelectedValue))
            {
                sSuperFranchiseeId = "0";
            }
            else
            {
                sSuperFranchiseeId = ddlSuperFranchisee.SelectedValue.ToString();
            }

            string qrCodeURL = _QRCODEURL.Replace("#QRCODE#", txtCustomerCode.Text);
            qrCodeURL = qrCodeURL.Replace("#FNAME#", "&utm_campaign=" + txtMasterFranchiseeName.Text);
            qrCodeURL = _QRCodeStaticURL + "&referrer=utm_source=" + HttpUtility.UrlEncode(qrCodeURL);



            if (BtnSave.Text.Equals("Update"))
            {
                string[] para1 = { txtMasterFranchiseeName.Text, txtContactNumber.Text, txtEmailAddress.Text, txtCustomerCode.Text, txtShortUrl.Text, IsActive.ToString(), sSuperFranchiseeId, dbc.getindiantime().ToString("dd-MMM-yyyy HH:mm:ss"), qrCodeURL, id1 };
                string   query = "UPDATE [MasterFranchisee] SET [MasterFranchiseeName]=@1,[MasterFranchiseeContactNumber]=@2,[MasterFranchiseeEmailAddress]=@3,[MasterFranchiseeCustomerCode]=@4," +
                                 " [ShortUrl]=@5,[IsActive]=@6,[SuperFranchiseeID]=@7,[CreatedOn]=@8,[QRCodeUrl]=@9 where [MasterFranchiseeID]=@10";
                int v1 = dbc.ExecuteQueryWithParams(query, para1);
                if (v1 > 0)
                {
                    string updateUser = "******" + txtUserName.Text.ToString() + "',[Password]='" + txtPassword.Text.ToString() + "'," +
                                        " [Name]='" + txtUserName.Text.ToString() + "',[UserType]=5,[FranchiseeId]=" + id1 + ",[Mobile] = '" + txtContactNumber.Text.ToString() + "'" +
                                        " WHERE FranchiseeId = " + id1;
                    int userVAL = dbc.ExecuteQuery(updateUser);
                    sweetMessage("", "Master Franchisee Updated Successfully", "success");
                    Response.Redirect("MasterFranchiseeList.aspx", true);
                }
            }
            else
            {
                byte[] QRCodebyteImage = GenerateQRCode(qrCodeURL);
                string newfileName     = txtMasterFranchiseeName.Text + "_" + txtCustomerCode.Text;
                newfileName = newfileName.Replace(" ", String.Empty);
                string filepath = "~/Content/images/QRCodeImages/" + newfileName + ".png";
                string tempFile = HttpContext.Current.Server.MapPath(filepath);
                using (var ms = new MemoryStream(QRCodebyteImage))
                {
                    using (FileStream fs = File.Create(tempFile, 1024))
                    {
                        ms.WriteTo(fs);
                    }
                    ms.Close();
                    ms.Flush();
                }


                string[] para1 = { txtMasterFranchiseeName.Text.ToString().Replace("'", "''"),
                                   txtContactNumber.Text.ToString().Replace("'",        "''"),
                                   txtEmailAddress.Text.ToString().Replace("'",         "''"),
                                   txtCustomerCode.Text.ToString().Replace("'",         "''"),
                                   txtShortUrl.Text.ToString(),
                                   IsActive.ToString(),
                                   sSuperFranchiseeId,
                                   dbc.getindiantimeString(),
                                   "0",
                                   qrCodeURL,
                                   filepath };
                string   query = "INSERT INTO [dbo].[MasterFranchisee] ([MasterFranchiseeName] ,[MasterFranchiseeContactNumber],[MasterFranchiseeEmailAddress],[MasterFranchiseeCustomerCode]," +
                                 " [ShortUrl],[IsActive],[SuperFranchiseeID],[CreatedOn],[IsDeleted],[QRCodeUrl],[QrCodeImage])" +
                                 " VALUES (@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11); SELECT SCOPE_IDENTITY();";
                int VAL = dbc.ExecuteQueryWithParamsId(query, para1);
                if (VAL > 0)
                {
                    hdnFranchiseeID.Value = VAL.ToString();
                    hdnContact.Value      = txtContactNumber.Text.ToString().Replace("'", "''");

                    string InsertUserqry = "INSERT INTO [Users] ([UserName],[Password],[Name],[UserType],[FranchiseeId],[Mobile]) VALUES ('" + txtUserName.Text.ToString().Replace("'", "''") + "','" + txtPassword.Text.ToString().Replace("'", "''") + "','" + txtUserName.Text.ToString().Replace("'", "''") + "',5," + VAL.ToString() + ",'" + txtContactNumber.Text.ToString() + "')";
                    int    userVAL       = dbc.ExecuteQuery(InsertUserqry);

                    sweetMessage("", "Master Franchisee Uploaded Successfully", "success");
                    Response.Redirect("MasterFranchiseeList.aspx", true);
                }
                else
                {
                    sweetMessage("", "Please Try Again!!", "warning");
                }
            }
        }
        catch (Exception E)
        {
            sweetMessage("", "Please Try Again!!", "warning");
        }
    }
Пример #17
0
    protected void PaytmButton_Click(object sender, EventArgs e)
    {
        Logger.InsertLogs(InvoiceLOGS.InvoiceLogLevel.Information, "", 2, false, "1.Trn came to make payment for: Paytm", "1");
        #region Paytm
        //antony commented for testing
        Dictionary <string, string> parameters = new Dictionary <string, string>();
        decimal orderamnt    = 0;
        string  email        = string.Empty;
        string  mobilenumber = string.Empty;
        string  C_id         = string.Empty;
        string  ordrid       = string.Empty;
        try
        {
            Logger.InsertLogs(InvoiceLOGS.InvoiceLogLevel.Information, "", 2, false, "1.Trn came to make payment for: Paytm", "2");
            string    qry            = "select PaidAmount,AddressId from [AlterNetOrder] where TrnId='" + txnId + "'";
            DataTable dtorderdetails = dbCon.GetDataTable(qry);
            if (dtorderdetails != null & dtorderdetails.Rows.Count > 0)
            {
                Logger.InsertLogs(InvoiceLOGS.InvoiceLogLevel.Information, "", 2, false, "1.Trn came to make payment for: Paytm", "3");
                bool o = decimal.TryParse(dtorderdetails.Rows[0]["PaidAmount"].ToString(), out orderamnt);

                string    qryadd       = "select CustomerId,MobileNo,Email from CustomerAddress where Id=" + dtorderdetails.Rows[0]["AddressId"].ToString() + "";
                DataTable dtadddetails = dbCon.GetDataTable(qryadd);
                if (dtadddetails != null & dtadddetails.Rows.Count > 0)
                {
                    Logger.InsertLogs(InvoiceLOGS.InvoiceLogLevel.Information, "", 2, false, "1.Trn came to make payment for: Paytm", "4");
                    email        = dtadddetails.Rows[0]["Email"].ToString();
                    mobilenumber = dtadddetails.Rows[0]["MobileNo"].ToString();
                    C_id         = dtadddetails.Rows[0]["CustomerId"].ToString();
                    ordrid       = txnId;
                    Logger.InsertLogs(InvoiceLOGS.InvoiceLogLevel.Information, "", 2, false, "1.Trn came to make payment for: Paytm", "5");
                }
            }
            //email = "*****@*****.**";
            //mobilenumber = "1616161616";
            //C_id = "1";
            //ordrid = "2019091715301218131";
        }
        catch (Exception err)
        {
            Logger.InsertLogs(InvoiceLOGS.InvoiceLogLevel.Error, ordrid, 2, false, "1.Trn came to make payment for PATM:ERROR", "MSG: " + err.Message.ToString());
        }

        Logger.InsertLogs(InvoiceLOGS.InvoiceLogLevel.Information, ordrid, 2, false, "1.Trn came to make payment for PAYTM", " ");
        if (orderamnt > 0 && !String.IsNullOrEmpty(ordrid) && !String.IsNullOrEmpty(email) && !String.IsNullOrEmpty(C_id))
        {
            //orderamnt = 1; //REMOVE
            try
            {
                String Str1 = "UPDATE [dbo].[CitrusPayment] SET [Payment_Method_Id] = @1 ,[Cit_TimeOfTransaction] = DATEADD(MINUTE, 330, GETUTCDATE()) ,[HasGone] = @2,[IsRecordsFetchedFromCitrus]= @3, [GoneTime] = DATEADD(MINUTE, 330, GETUTCDATE()) WHERE [TxnId] = '" + ordrid + "'";

                string[] parm = { "2", "1", "0" };

                int resval = dbCon.ExecuteQueryWithParams(Str1, parm);
                if (resval > 0)
                {
                    String Str2 = "UPDATE [dbo].[AlterNetOrder] SET [PaymentGatewayId] = @1 ,[UpdatedOnUtc] = DATEADD(MINUTE, 330, GETUTCDATE()) WHERE [TrnId] = '" + ordrid + "'";

                    string[] parm2 = { "2" };

                    int resval2 = dbCon.ExecuteQueryWithParams(Str2, parm2);
                    if (resval2 > 0)
                    {
                        String Str3 = "UPDATE [dbo].[Order] SET [PaymentGatewayId] = @1 ,[UpdatedOnUtc] = DATEADD(MINUTE, 330, GETUTCDATE()) WHERE [TRNID] = '" + ordrid + "'";

                        string[] parm3 = { "2" };

                        int resval3 = dbCon.ExecuteQueryWithParams(Str3, parm3);
                    }
                }
            }
            catch (Exception err)
            {
            }
            #region paytm
            string PayAmt = String.Format("{0:0.00}", orderamnt);

            parameters.Add("MID", Constant.Message.PAYTM_MID);
            parameters.Add("CHANNEL_ID", Constant.Message.PAYTM_channel_id);
            parameters.Add("INDUSTRY_TYPE_ID", Constant.Message.PAYTM_Industry_Type);
            parameters.Add("WEBSITE", Constant.Message.PAYTM_website);
            parameters.Add("EMAIL", email);
            parameters.Add("MOBILE_NO", mobilenumber);
            parameters.Add("CUST_ID", C_id);
            parameters.Add("ORDER_ID", ordrid);
            parameters.Add("TXN_AMOUNT", PayAmt);
            parameters.Add("CALLBACK_URL", Constant.Message.PG_ReturnURL_Paym); //This parameter is not mandatory. Use this to pass the callback url dynamically.

            //if (_customerService.IsCustomerEligibleto_Paytm_Promo(_workContext.CurrentCustomer.Id))
            //{
            //    parameters.Add("PROMO_CAMP_ID", "PAYTMSB");
            //}
            string getCheckSum = dbCon.genCheckSum(parameters, Constant.Message.PAYTM_merchantKey);
            parameters.Add("CHECKSUMHASH", getCheckSum);
            String paytm_trnid = string.Empty;
            paytm_trnid = ordrid;

            string outputHTML = "<html>";
            outputHTML += "<head>";
            outputHTML += "<title>SaleBhai Check Out Page</title>";
            outputHTML += "</head>";
            outputHTML += "<body>";
            outputHTML += "<center><h1>Please do not refresh this page...</h1></center>";
            outputHTML += "<form method='post' action='" + Constant.Message.PAYTM_URL + ordrid + "' name='f1'>";
            outputHTML += "<table border='1'>";
            outputHTML += "<tbody>";
            foreach (string key in parameters.Keys)
            {
                outputHTML += "<input type='hidden' name='" + key + "' value='" + parameters[key] + "'>";
            }
            outputHTML += "<input type='hidden' name='CHECKSUMHASH' value='" + getCheckSum + "'>";
            outputHTML += "</tbody>";
            outputHTML += "</table>";
            outputHTML += "<script type='text/javascript'>";
            outputHTML += "document.f1.submit();";
            outputHTML += "</script>";
            outputHTML += "</form>";
            outputHTML += "</body>";
            outputHTML += "</html>";
            Response.Write(outputHTML);
            #endregion
        }
        else
        {
            //SOME VALUE IS MISSING
            Logger.InsertLogs(InvoiceLOGS.InvoiceLogLevel.Error, "", 2, false, "1.Trn came to make payment for: PAYTM", "Email = " + email + ",Custid = " + C_id.ToString() + ",mobile = " + mobilenumber + ",trnid" + ordrid);
        }
        #endregion
    }
Пример #18
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string userId   = Request.Cookies["TUser"]["Id"].ToString();
            int    IsActive = 0;

            DateTime dt = DateTime.Now;
            if (chkisactive.Checked)
            {
                IsActive = 1;
            }

            string[] para1 = { txtDeliveryIncharge.Text.ToString().Replace("'", "''"),
                               txtContact.Text.ToString().Replace("'",          "''"),
                               txtEmailId.Text.ToString().Replace("'",          "''"),
                               ddlState.SelectedItem.Value,
                               ddlCity.SelectedItem.Value,
                               txtComments.Text.ToString().Replace("'",         "''"),
                               IsActive.ToString(),
                               dt.ToString(),
                               userId };
            if (BtnSave.Text.Equals("Update"))
            {
                string id = Request.QueryString["id"].ToString();
                //string delDeliveryDetail = " DELETE FROM DeliveryDetail WHERE DeliveryId = " + id;
                //dbc.ExecuteQuery(delDeliveryDetail);
                //int areaId = Convert.ToInt32(ddlArea.SelectedValue);
                //string pincode = string.Empty;
                //string pincodeQry = " SELECT Top 1 zipCode FROM ZipCode WHERE Id = " + areaId;
                //DataTable dtPincode = dbc.GetDataTable(pincodeQry);
                //if (dtPincode.Rows.Count > 0)
                //{
                //    pincode = dtPincode.Rows[0]["zipcode"].ToString();
                //}
                //string InsertDetailqry = "";
                //List<ListItem> selectedArea = new List<ListItem>();
                //selectedArea = chklstArea.Items.Cast<ListItem>().Where(n => n.Selected).ToList();
                //foreach (ListItem item in selectedArea)
                //{
                //    InsertDetailqry = "INSERT INTO [DeliveryDetail] ([DeliveryID],[PinCodeID],[AreaId],[BuildingId],[IsActive],[CreatedOn],[CreatedBy]) VALUES ('" + id + "','" + pincode + "'," + areaId + "," + item.Value + "," + IsActive + ",'" + dt + "'," + userId + ")";
                //    dbc.ExecuteQuery(InsertDetailqry);
                //}

                string query = " UPDATE [DeliveryMaster] SET [DeliveryIncharge]=@1,[Contact]=@2,[EmalID]=@3,[StateId]=@4,[CityId]=@5,[Comments]=@6, " +
                               " [IsActive] = @7,[CreatedOn] = @8,[CreatedBy] = @9 WHERE DeliveryId = " + id;
                int v1 = dbc.ExecuteQueryWithParams(query, para1);
                if (v1 > 0)
                {
                    string updateUser = "******" + txtUserName.Text.ToString() + "',[Password]='" + txtPassword.Text.ToString() + "'," +
                                        " [Name]='" + txtUserName.Text.ToString() + "',[UserType]=3,[DeliveryID]=" + id + ",[Mobile] = '" + txtContact.Text.ToString() + "'" +
                                        " WHERE DeliveryId = " + id;
                    int userVAL = dbc.ExecuteQuery(updateUser);
                    sweetMessage("", "Delivery Updated Successfully", "success");
                    Response.Redirect("Delivery.aspx");
                }
            }
            else
            {
                string query1 = "INSERT INTO [DeliveryMaster] ([DeliveryIncharge],[Contact],[EmalID],[StateId],[CityId],[Comments],[IsActive],[CreatedOn],[CreatedBy]) VALUES (@1,@2,@3,@4,@5,@6,@7,@8,@9); SELECT SCOPE_IDENTITY();";
                int    VAL    = dbc.ExecuteQueryWithParamsId(query1, para1);

                if (VAL > 0)
                {
                    int       areaId     = Convert.ToInt32(ddlArea.SelectedValue);
                    string    pincode    = string.Empty;
                    string    pincodeQry = " SELECT Top 1 zipCode FROM ZipCode WHERE Id = " + areaId;
                    DataTable dtPincode  = dbc.GetDataTable(pincodeQry);
                    if (dtPincode.Rows.Count > 0)
                    {
                        pincode = dtPincode.Rows[0]["zipcode"].ToString();
                    }
                    string          InsertDetailqry = "";
                    List <ListItem> selectedArea    = new List <ListItem>();
                    selectedArea = chklstArea.Items.Cast <ListItem>().Where(n => n.Selected).ToList();
                    foreach (ListItem item in selectedArea)
                    {
                        InsertDetailqry = "INSERT INTO [DeliveryDetail] ([DeliveryID],[PinCodeID],[AreaId],[BuildingId],[IsActive],[CreatedOn],[CreatedBy]) VALUES ('" + VAL + "','" + pincode + "'," + areaId + "," + item.Value + "," + IsActive + ",'" + dt + "'," + userId + ")";
                        dbc.ExecuteQuery(InsertDetailqry);
                    }
                    if (Convert.ToInt32(VAL) > 0)
                    {
                        hdnDeliveryID.Value = VAL.ToString();
                        hdnContact.Value    = txtContact.Text.ToString().Replace("'", "''");

                        string InsertUserqry = "INSERT INTO [Users] ([UserName],[Password],[Name],[UserType],[DeliveryID],[Mobile]) VALUES ('" + txtUserName.Text.ToString().Replace("'", "''") + "','" + txtPassword.Text.ToString().Replace("'", "''") + "','" + txtUserName.Text.ToString().Replace("'", "''") + "',3," + VAL.ToString() + ",'" + txtContact.Text.ToString() + "')";
                        int    userVAL       = dbc.ExecuteQuery(InsertUserqry);

                        sweetMessage("", "Delivery Added Successfully", "success");
                        Response.Redirect("Delivery.aspx");
                    }
                    else
                    {
                        hdnDeliveryID.Value = "0";
                        sweetMessage("", "Please Try Again!!", "warning");
                    }
                }
                else
                {
                    sweetMessage("", "Please Try Again!!", "warning");
                }
            }
        }
        catch (Exception E)
        {
            sweetMessage("", "Please Try Again!!", "warning");
        }
    }
Пример #19
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string       userId = Request.Cookies["TUser"]["Id"].ToString();
            int          IsActive = 0, IsDefault = 0;
            string[]     validFileTypes = { "png", "jpg", "jpeg" };
            Stream       fs             = FileUpload1.PostedFile.InputStream;
            BinaryReader br             = new BinaryReader(fs);
            Byte[]       image          = br.ReadBytes((Int32)fs.Length);

            string exten = System.IO.Path.GetExtension(FileUpload1.FileName);
            string name  = System.IO.Path.GetFileName(FileUpload1.FileName);

            string ext = System.IO.Path.GetExtension(FileUpload1.FileName);

            bool   isValidFile = false;
            string imgname = "", imgnamenew = "";
            if (FileUpload1.HasFile)
            {
                for (int i = 0; i < validFileTypes.Length; i++)
                {
                    if (ext == "." + validFileTypes[i])
                    {
                        isValidFile = true;
                        break;
                    }
                    else
                    {
                        //lblmsg.Text = "Line : 349 : " + aa.Message;
                    }
                }

                if (!isValidFile)
                {
                    return;
                }


                ext = ext.Replace(".", "images/");

                imgname    = DateTime.Now.Ticks + exten;
                imgnamenew = FileUpload1.FileName;
                string path = Server.MapPath("/CategoryImage");
                FileUpload1.SaveAs(path + "/" + imgnamenew);
            }

            string fileName = "";
            fileName = imgnamenew;


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

            if (chkIsDefault.Checked)
            {
                IsDefault = 1;
            }

            DateTime dt = DateTime.Now;

            if (BtnSave.Text.Equals("Update"))
            {
                if (IsDefault == 1)
                {
                    string updateQry = " UPDATE [Category] SET IsDefault = 0 ";
                    dbc.ExecuteQuery(updateQry);
                }
                string id = Request.QueryString["id"].ToString();
                if (fileName != "")
                {
                    string[] para1 = { txtCategoryName.Text, txtDescription.Text, IsActive.ToString(), fileName, dt.ToString(), userId, id, txtSequence.Text, IsDefault.ToString() };
                    string   query = "UPDATE [Category] SET [CategoryName]=@1,[CategoryDescription]=@2,[IsActive]=@3,[CategoryImage]=@4,[ModifiedOn]=@5,[ModifiedBy]=@6,[sequence]=@8, [IsDefault]=@9 where [CategoryID]=@7";
                    int      v1    = dbc.ExecuteQueryWithParams(query, para1);
                    if (v1 > 0)
                    {
                        sweetMessage("", "Category Updated Successfully", "success");
                        Response.Redirect("Category.aspx", true);
                    }
                }
                else if (fileName == "")
                {
                    string[] para1 = { txtCategoryName.Text, txtDescription.Text, IsActive.ToString(), dt.ToString(), userId, id, txtSequence.Text, IsDefault.ToString() };

                    string query = "UPDATE [Category] SET [CategoryName]=@1,[CategoryDescription]=@2,[IsActive]=@3,[ModifiedOn]=@4,[ModifiedBy]=@5,[sequence]=@7, [IsDefault]=@8 where [CategoryID]=@6";
                    int    v1    = dbc.ExecuteQueryWithParams(query, para1);
                    if (v1 > 0)
                    {
                        sweetMessage("", "Category Updated Successfully", "success");
                        Response.Redirect("Category.aspx", true);
                    }
                    else
                    {
                        sweetMessage("", "Please Try Again!!", "warning");
                    }
                }
            }
            else
            {
                if (IsDefault == 1)
                {
                    string updateQry = " UPDATE [Category] SET IsDefault = 0 ";
                    dbc.ExecuteQuery(updateQry);
                }
                string query = "INSERT INTO [dbo].[Category] ([CategoryName] ,[CategoryDescription],[CategoryImage],[IsActive],[IsDeleted],[CreatedOn],[CreatedBy],[sequence],[IsDefault]) VALUES ('" + txtCategoryName.Text.ToString().Replace("'", "''") + "','" + txtDescription.Text.ToString().Replace("'", "''") + "','" + fileName + "'," + IsActive + ",0,'" + dt.ToString() + "'," + userId + "," + txtSequence.Text + "," + IsDefault + ")";
                int    VAL   = dbc.ExecuteQuery(query);

                if (VAL > 0)
                {
                    sweetMessage("", "Category Added Successfully", "success");
                    Response.Redirect("Category.aspx", true);
                }
                else
                {
                    sweetMessage("", "Please Try Again!!", "warning");
                }
            }
        }
        catch (Exception E)
        {
            sweetMessage("", "Please Try Again!!", "warning");
        }
    }