Ejemplo n.º 1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         int            adminId        = Convert.ToInt32(hdnAdminId.Value);
         Administrators administrators = bAdministrator.List().Where(m => m.Administrators_Id == adminId).FirstOrDefault();
         administrators.Admin_UpdatedDate = DateTime.Now;
         administrators.Password          = txtPassword.Text;
         administrators = bAdministrator.Update(administrators);
         ActivityHelper.Create("Password Reset", "Password Updated on " + DateTime.Now.ToString("D") + " Successfully", adminId);
         if (string.IsNullOrEmpty(administrators.ErrorMessage))
         {
             Response.Redirect("~/account/logout.aspx?logout=1000&redUrl=HGHGH786876");
         }
         else
         {
             pnlErrorMessage.Attributes.Remove("class");
             pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
             pnlErrorMessage.Visible             = true;
             lblMessage.Text = "Failed!" + administrators.ErrorMessage;
         }
     }
     catch (Exception ex)
     {
         pnlErrorMessage.Attributes.Remove("class");
         pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
         pnlErrorMessage.Visible             = true;
         lblMessage.Text = ex.InnerException.InnerException.Message;
     }
 }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                int            adminId        = Convert.ToInt32(hdnAdminId.Value);
                Administrators administrators = bAdministrator.List().Where(m => m.Administrators_Id == adminId).FirstOrDefault();

                administrators.FullName           = txtFullname.Text;
                administrators.EmailId            = txtEmailId.Text;
                administrators.Description        = txtDescription.Text;
                administrators.Phone              = txtPhone.Text;
                administrators.Admin_Status       = ddlStatus.Text;
                administrators.Admin_Role         = ddlRole.Text;
                administrators.Photo              = administrators.Photo;
                administrators.Send_Activity_Mail = (chkGetActivityMail.Checked) ? 1 : 0;

                if (imgInp.HasFile)
                {
                    administrators.Photo = "files/administrators/" + "Admin_" + administrators.Administrators_Id + ".png";
                    administrators       = bAdministrator.Update(administrators);
                    if (string.IsNullOrEmpty(administrators.ErrorMessage))
                    {
                        string   path = Server.MapPath("../" + administrators.ProductBanner);
                        FileInfo file = new FileInfo(path);
                        if (file.Exists)//check file exsit or not
                        {
                            file.Delete();
                        }
                        Upload(administrators.Administrators_Id.ToString());
                    }
                    else
                    {
                        pnlErrorMessage.Attributes.Remove("class");
                        pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                        pnlErrorMessage.Visible             = true;
                        lblMessage.Text = "Failed!" + administrators.ErrorMessage;
                    }
                }
                else
                {
                    administrators.Admin_UpdatedDate = DateTime.Now;
                    administrators = bAdministrator.Update(administrators);
                }

                ActivityHelper.Create("Profile Updaion", "Admin Profile Updated On " +
                                      DateTime.Now.ToString("D") + " Successfully, for EmailId " + administrators.EmailId + ".",
                                      Convert.ToInt32(Session[ConfigurationSettings.AppSettings["AdminSession"].ToString()].ToString()));

                LoadDetail(administrators.Administrators_Id.ToString());
                Response.Redirect("/administration/alladmin.aspx?id=100&redirect-url=uyiretieyt7985798435ihtiuertireyte&id-red=alladmin.html");
            }
            catch (Exception ex)
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = ex.Message;
            }
        }
Ejemplo n.º 3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                int           subCatId     = Convert.ToInt32(hdnCatId.Value);
                int           catId        = Convert.ToInt32(hdnCurrentSubCatCatId.Value);
                SubCategories _otherSubCat = bSubCategory.List().Where(m => m.Category_Id == catId && m.SubCategory_Id != subCatId & m.SubCategory_Title == txtCategory.Text).FirstOrDefault();
                int           adminId      = Convert.ToInt32(Session[ConfigurationSettings.AppSettings["AdminSession"].ToString()]);
                if (_otherSubCat == null)
                {
                    SubCategories SubCategories = bSubCategory.List().Where(m => m.SubCategory_Id == subCatId).FirstOrDefault();
                    SubCategories.SubCategory_Title       = txtCategory.Text;
                    SubCategories.SubCategory_UpdatedDate = DateTime.Now;
                    SubCategories.Administrators_Id       = adminId;
                    SubCategories.Category_Id             = Convert.ToInt32(ddlCategory.SelectedValue);
                    SubCategories.SubCategory_Status      = (chkIsActive.Checked) ? eStatus.Active.ToString() : eStatus.InActive.ToString();

                    SubCategories = bSubCategory.Update(SubCategories);

                    if (string.IsNullOrEmpty(SubCategories.ErrorMessage) && SubCategories.SubCategory_Status == eStatus.InActive.ToString())
                    {
                        List <Product> products = new List <Product>();
                        products = bProduct.List().Where(m => m.Product_Status == eProductStatus.Published.ToString() && m.SubCategory.SubCategory_Id == SubCategories.SubCategory_Id).ToList();

                        foreach (var item in products)
                        {
                            item.Product_Status = eProductStatus.ReviewPending.ToString();
                            bProduct.Update(item);
                            ProductHelper.CreateProductFlow(item.Product_Id, item.Product_Title, adminId, "System", "Sub Category In Active : Product Updated and set to Review Pending Status", item.Product_Status);
                            bProduct.DeleteTopEight(item.Product_Id);
                            bProduct.DeleteProductFeature(item.Product_Id);
                            bProduct.DeleteCart(item.Product_Id);
                        }
                    }

                    ActivityHelper.Create("Update Sub Category", "Sub Category Updated On " + DateTime.Now.ToString("D") + " Successfully and Title is " + SubCategories.SubCategory_Title + ".", adminId);

                    Response.Redirect("/administration/categories/subcategory.aspx?id=2000&redirecturl=admin-category-RachnaTeracotta");
                }
                else
                {
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text = "Oops!! Sub Category not updated successfully, sub category name should not be same as other.";
                }
            }
            catch (Exception ex)
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = "Oops!! " + ex.Message.ToString();
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int    storeId   = Convert.ToInt32(hdnStoreId.Value);
            Stores _otherStr = bStores.List().Where(m => m.Store_Id != storeId && m.Store_Name == txtStoreName.Text.Trim()).FirstOrDefault();

            if (_otherStr == null)
            {
                Stores stores = bStores.List().Where(m => m.Store_Id == storeId).FirstOrDefault();
                stores.Store_Name        = txtStoreName.Text;
                stores.Store_Url         = txtImageUrl.Text;
                stores.Store_Status      = ddlStatus.Text;
                stores.Store_UpdatedDate = DateTime.Now;
                stores.Store_Description = txtDescription.Text;
                if (imgInp.HasFile)
                {
                    stores.Store_Logo = "files/store/" + "Store_" + stores.Store_Id + ".png";
                    string   path = Server.MapPath("../" + stores.Store_Logo);
                    FileInfo file = new FileInfo(path);
                    if (file.Exists)//check file exsit or not
                    {
                        file.Delete();
                    }
                    Upload(stores.Store_Id);
                }

                stores.Store_Url = "?storecode=" + stores.StoreCode + "&redirect-url=" + stores.Store_Name.Trim() + ".html";
                stores           = bStores.Update(stores);

                ActivityHelper.Create("Store Updation", "Store Detail Updated On " +
                                      DateTime.Now.ToString("D") + " Successfully, for Store Name " + stores.Store_Name + ".",
                                      Convert.ToInt32(Session[ConfigurationSettings.AppSettings["AdminSession"].ToString()].ToString()));

                if (String.IsNullOrEmpty(stores.ErrorMessage))
                {
                    Response.Redirect("/administration/store.aspx?id=100&redirecturl=admin-store-rachna-teracotta");
                }
                else
                {
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text = "Failed!" + stores.ErrorMessage;
                }
            }
            else
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = "Oops!! Store detail not updated successfully, because store name should not be same as other";
            }
        }
Ejemplo n.º 5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Categories _category1 = new Categories();
                _category1 = bCategory.List().Where(m => m.Category_Title == txtCategory.Text).FirstOrDefault();
                int adminId = Convert.ToInt32(Session[ConfigurationSettings.AppSettings["AdminSession"].ToString()].ToString());
                if (_category1 == null)
                {
                    Categories Categories = new Categories()
                    {
                        Category_Title       = txtCategory.Text,
                        Administrators_Id    = adminId,
                        Category_Photo       = (imgInp.HasFile) ? "files/category/" + "Category_" + imgInp.FileName : "content/noimage.png",
                        Category_CreatedDate = DateTime.Now,
                        Category_UpdatedDate = DateTime.Now,
                        Category_Status      = eStatus.Active.ToString()
                    };

                    Categories = bCategory.Create(Categories);
                    ActivityHelper.Create("New Category", "New Category Created On " + DateTime.Now.ToString("D") + " Successfully and Title is " + Categories.Category_Title + ".", adminId);

                    if ((Categories.Category_Id != null || Categories.Category_Id != 0) && imgInp.HasFile)
                    {
                        Upload();
                    }

                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-success alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text  = "Success!!! Category Created Successfully.";
                    txtCategory.Text = "";
                }
                else
                {
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text = "Category cannot be created. Entered Category Name already exists in the database.";
                }
            }
            catch (Exception ex)
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = ex.Message;
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Stores Stores1 = bStores.List().Where(m => m.Store_Name == txtStoreName.Text.Trim()).FirstOrDefault();

            if (Stores1 == null)
            {
                Stores stores = new Stores()
                {
                    Store_Name        = txtStoreName.Text.Trim(),
                    Store_Logo        = "files/store/" + "Store_" + imgInp.FileName,
                    Store_Status      = eStatus.Active.ToString(),
                    Store_Description = txtDescription.Text,
                    Store_CreatedDate = DateTime.Now,
                    Store_UpdatedDate = DateTime.Now
                };

                stores = bStores.Create(stores);
                ActivityHelper.Create("New Store Creation", "New Store Created On " +
                                      DateTime.Now.ToString("D") + " Successfully, for Store Name " + stores.Store_Name + ".",
                                      Convert.ToInt32(Session[ConfigurationSettings.AppSettings["AdminSession"].ToString()].ToString()));

                if (String.IsNullOrEmpty(stores.ErrorMessage))
                {
                    Upload();

                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-success alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text = "Store Detail Updated Successfully";
                    ClearFields();
                }
                else
                {
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text = "Failed!" + stores.ErrorMessage;
                }
            }
            else
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = "Oops!! Store detail not updated successfully, because store name should not be same as other";
            }
        }
Ejemplo n.º 7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                SubCategories _category1 = new SubCategories();
                int           catId      = Convert.ToInt32(ddlCategory.SelectedValue);
                _category1 = bSubCategory.List().Where(m => m.Category_Id == catId && m.SubCategory_Title == txtCategory.Text).FirstOrDefault();
                int adminId = Convert.ToInt32(Session[ConfigurationSettings.AppSettings["AdminSession"].ToString()].ToString());
                if (_category1 == null)
                {
                    SubCategories SubCategories = new SubCategories()
                    {
                        SubCategory_Title       = txtCategory.Text,
                        Administrators_Id       = adminId,
                        Category_Id             = Convert.ToInt32(ddlCategory.SelectedValue),
                        SubCategory_CreatedDate = DateTime.Now,
                        SubCategory_UpdatedDate = DateTime.Now,
                        SubCategory_Status      = eStatus.Active.ToString()
                    };

                    bSubCategory.Create(SubCategories);
                    ActivityHelper.Create("New Sub Category", "New Sub Category Created On " + DateTime.Now.ToString("D") + " Successfully and Title is " + SubCategories.SubCategory_Title + ".", adminId);

                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-success alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text = "New Sub Category Created Successfully..";
                    ClearFields();
                }
                else
                {
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text = "Sub Category cannot be created. Entered Sub Category Name already exists in the database.";
                }
            }
            catch (Exception ex)
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = ex.Message;
            }
        }
Ejemplo n.º 8
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string str = Globals.RequestFormStr("action");

            if (!string.IsNullOrEmpty(str))
            {
                if (str == "End")
                {
                    int aid = Globals.RequestFormNum("delId");
                    if (aid > 0)
                    {
                        if (ActivityHelper.EndAct(aid))
                        {
                            context.Response.Write("{\"state\":\"true\",\"msg\":\"活动成功结束\"}");
                        }
                        else
                        {
                            context.Response.Write("{\"state\":\"false\",\"msg\":\"活动结束失败\"}");
                        }
                    }
                    else
                    {
                        context.Response.Write("{\"state\":\"false\",\"msg\":\"参数不正确\"}");
                    }
                }
            }
            else
            {
                try
                {
                    int      id    = int.Parse(context.Request["id"].ToString());
                    string   str2  = context.Request["name"].ToString();
                    string   val   = context.Request["begin"].ToString();
                    string   str4  = context.Request["end"].ToString();
                    string   str5  = context.Request["memberlvl"].ToString();
                    string   str6  = context.Request["defualtGroup"].ToString();
                    string   str7  = context.Request["customGroup"].ToString();
                    string   str8  = context.Request["maxNum"].ToString();
                    string   str9  = context.Request["type"].ToString();
                    string   str10 = context.Request["attendType"].ToString();
                    string   str11 = context.Request["meetType"].ToString();
                    int      i     = 0;
                    int      num4  = 0;
                    DateTime now   = DateTime.Now;
                    DateTime time2 = DateTime.Now;
                    int      num5  = 0;
                    int      num6  = 0;
                    if (str2.Length > 30)
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"活动名称不能超过30个字符\"}");
                    }
                    else if (!val.bDate(ref now))
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"请输入正确的开始时间\"}");
                    }
                    else if (!str4.bDate(ref time2))
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"请输入正确的结束时间\"}");
                    }
                    else if (time2 < now)
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"结束时间不能早于开始时间\"}");
                    }
                    else if ((string.IsNullOrEmpty(str5) && string.IsNullOrEmpty(str6)) && string.IsNullOrEmpty(str7))
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"请选择适用会员等级\"}");
                    }
                    else if (!str8.bInt(ref num5))
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"请选择参与次数\"}");
                    }
                    else if (!str9.bInt(ref num6))
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"请选择参与商品类型\"}");
                    }
                    else if (!str10.bInt(ref i))
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"请选择优惠类型\"}");
                    }
                    else if (!str11.bInt(ref num4))
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"请选择优惠条件\"}");
                    }
                    else
                    {
                        List <ActivityDetailInfo> list = new List <ActivityDetailInfo>();
                        JArray array = (JArray)JsonConvert.DeserializeObject(context.Request.Form["stk"].ToString());
                        if (array.Count > 1)
                        {
                            for (int j = 0; j < (array.Count - 1); j++)
                            {
                                JToken token = array[j]["meet"];
                                for (int k = j + 1; k < array.Count; k++)
                                {
                                    if (array[k]["meet"] == token)
                                    {
                                        context.Response.Write("{\"type\":\"error\",\"data\":\"多级优惠的各级满足金额不能相同\"}");
                                        return;
                                    }
                                }
                            }
                        }
                        if (array.Count > 0)
                        {
                            for (int m = 0; m < array.Count; m++)
                            {
                                ActivityDetailInfo item  = new ActivityDetailInfo();
                                string             str12 = array[m]["meet"].ToString();
                                string             str13 = array[m]["meetNumber"].ToString();
                                string             str14 = array[m]["redus"].ToString();
                                string             str15 = array[m]["free"].ToString();
                                string             str16 = array[m]["point"].ToString();
                                string             str17 = array[m]["coupon"].ToString();
                                decimal            num10 = 0M;
                                int     num11            = 0;
                                decimal num12            = 0M;
                                bool    flag             = false;
                                int     num13            = 0;
                                int     num14            = 0;
                                int     num15            = 0;
                                if (!str13.bInt(ref num11))
                                {
                                    int num17 = m + 1;
                                    context.Response.Write("{\"type\":\"error\",\"data\":\"第" + num17.ToString() + "级优惠满足次数输入错误!\"}");
                                    return;
                                }
                                if (!str12.bDecimal(ref num10))
                                {
                                    int num18 = m + 1;
                                    context.Response.Write("{\"type\":\"error\",\"data\":\"第" + num18.ToString() + "级优惠满足金额输入错误!\"}");
                                    return;
                                }
                                if (!str14.bDecimal(ref num12))
                                {
                                    int num19 = m + 1;
                                    context.Response.Write("{\"type\":\"error\",\"data\":\"第" + num19.ToString() + "级优惠减免金额输入错误!\"}");
                                    return;
                                }
                                if (!str15.bInt(ref num15))
                                {
                                    int num20 = m + 1;
                                    context.Response.Write("{\"type\":\"error\",\"data\":\"第" + num20.ToString() + "级优惠免邮选择错误!\"}");
                                    return;
                                }
                                flag = num15 != 0;
                                if (!str16.bInt(ref num13))
                                {
                                    int num21 = m + 1;
                                    context.Response.Write("{\"type\":\"error\",\"data\":\"第" + num21.ToString() + "级优惠积分输入错误!\"}");
                                    return;
                                }
                                if (!str16.bInt(ref num13))
                                {
                                    int num22 = m + 1;
                                    context.Response.Write("{\"type\":\"error\",\"data\":\"第" + num22.ToString() + "级优惠积分输入错误!\"}");
                                    return;
                                }
                                if (!str17.bInt(ref num14))
                                {
                                    int num23 = m + 1;
                                    context.Response.Write("{\"type\":\"error\",\"data\":\"第" + num23.ToString() + "级优惠优惠券选择错误!\"}");
                                    return;
                                }
                                if ((num11 == 0) && (num12 > num10))
                                {
                                    int num24 = m + 1;
                                    context.Response.Write("{\"type\":\"error\",\"data\":\"第" + num24.ToString() + "级优惠减免金额不能大于满足金额!\"}");
                                    return;
                                }
                                item.ActivitiesId   = 0;
                                item.bFreeShipping  = flag;
                                item.CouponId       = num14;
                                item.MeetMoney      = num10;
                                item.MeetNumber     = num11;
                                item.ReductionMoney = num12;
                                item.Integral       = num13;
                                list.Add(item);
                            }
                        }
                        ActivityInfo act = new ActivityInfo();
                        if (id != 0)
                        {
                            act = ActivityHelper.GetAct(id);
                            if (act == null)
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"没有找到这个活动\"}");
                                return;
                            }
                        }
                        act.ActivitiesName = str2;
                        act.EndTime        = time2.Date.AddDays(1.0).AddSeconds(-1.0);
                        act.StartTime      = now.Date;
                        act.attendTime     = num5;
                        act.attendType     = i;
                        act.isAllProduct   = num6 == 0;
                        act.MemberGrades   = str5;
                        act.DefualtGroup   = str6;
                        act.CustomGroup    = str7;
                        act.Type           = 0;
                        act.MeetMoney      = 0M;
                        act.ReductionMoney = 0M;
                        act.Details        = list;
                        act.MeetType       = num4;
                        string msg          = "";
                        int    activitiesId = 0;
                        if (id == 0)
                        {
                            activitiesId = ActivityHelper.Create(act, ref msg);
                        }
                        else
                        {
                            activitiesId = act.ActivitiesId;
                            if (!ActivityHelper.Update(act, ref msg))
                            {
                                activitiesId = 0;
                            }
                        }
                        if (activitiesId > 0)
                        {
                            context.Response.Write("{\"type\":\"success\",\"data\":\"" + activitiesId.ToString() + "\"}");
                        }
                        else
                        {
                            context.Response.Write("{\"type\":\"error\",\"data\":\"" + msg + "\"}");
                        }
                    }
                }
                catch (Exception exception)
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"" + exception.Message + "\"}");
                }
            }
        }
Ejemplo n.º 9
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Administrators _admin1    = bAdministrator.List().Where(m => m.EmailId == txtEmailId.Text || m.Phone == txtPhone.Text).FirstOrDefault();
                Invitations    Invitation = bInvitations.List().Where(m => m.Invitation_EmailId == txtEmailId.Text).FirstOrDefault();
                if (_admin1 == null && Invitation == null)
                {
                    Invitations invitations = new Invitations()
                    {
                        Store_Id               = Convert.ToInt32(hdnStoreId.Value),
                        Invitation_Code        = Guid.NewGuid().ToString(),
                        Invitation_EmailId     = txtEmailId.Text,
                        Invitation_CreatedDate = DateTime.Now,
                        Invitation_Status      = eStatus.InActive.ToString(),
                        Role = ddlRole.Text,
                        Invitation_UpdatedDate = DateTime.Now
                    };

                    invitations = bInvitations.Create(invitations);
                    ActivityHelper.Create("New Invitation", "New Invitation Created On " +
                                          DateTime.Now.ToString("D") + " Successfully, for EmailId " + invitations.Invitation_EmailId + ".",
                                          Convert.ToInt32(Session[ConfigurationSettings.AppSettings["AdminSession"].ToString()].ToString()));

                    if (string.IsNullOrEmpty(invitations.ErrorMessage))
                    {
                        Administrators administrators = new Administrators()
                        {
                            Invitation_Id       = invitations.Invitation_Id,
                            FullName            = txtFullname.Text,
                            EmailId             = txtEmailId.Text,
                            Phone               = txtPhone.Text,
                            Description         = "admin description should be here",
                            Photo               = "content/noimage.png",
                            Password            = "******",
                            Admin_Status        = eStatus.Active.ToString(),
                            Admin_Role          = ddlRole.Text,
                            Admin_CreatedDate   = DateTime.Now,
                            Admin_UpdatedDate   = DateTime.Now,
                            Admin_Login_Attempt = 0,
                            Store_Id            = Convert.ToInt32(hdnStoreId.Value)
                        };

                        administrators = bAdministrator.Create(administrators);
                        ActivityHelper.Create("New Administrator", "New Administrator Created On " +
                                              DateTime.Now.ToString("D") + " Successfully, for EmailId " + administrators.Administrators_Id + ".",
                                              Convert.ToInt32(Session[ConfigurationSettings.AppSettings["AdminSession"].ToString()].ToString()));

                        if (string.IsNullOrEmpty(administrators.ErrorMessage))
                        {
                            if (Convert.ToBoolean(ConfigurationSettings.AppSettings["IsEmailEnable"]))
                            {
                                txtEmailId.Text = "";
                                string body = MailHelper.AccountCreated(administrators.FullName, administrators.EmailId, administrators.Password, administrators.Admin_Role);
                                MailHelper.SendEmail(administrators.EmailId, "[Rachna Teracotta]-New Account Creation", body, "[Rachna Teracotta]-New Account Creation");

                                txtEmailId.Text       = "";
                                txtFullname.Text      = "";
                                txtPhone.Text         = "";
                                ddlRole.SelectedIndex = 0;
                                pnlErrorMessage.Attributes.Remove("class");
                                pnlErrorMessage.Attributes["class"] = "alert alert-success alert-dismissable";
                                pnlErrorMessage.Visible             = true;
                                lblMessage.Text = "Success! Admin Detail Updated Successfully.";
                            }
                            else
                            {
                                txtEmailId.Text       = "";
                                txtFullname.Text      = "";
                                txtPhone.Text         = "";
                                ddlRole.SelectedIndex = 0;
                                pnlErrorMessage.Attributes.Remove("class");
                                pnlErrorMessage.Attributes["class"] = "alert alert-success alert-dismissable";
                                pnlErrorMessage.Visible             = true;
                                lblMessage.Text = "Success! New Admin Account created successfully.";
                            }
                        }
                        else
                        {
                            pnlErrorMessage.Attributes.Remove("class");
                            pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                            pnlErrorMessage.Visible             = true;
                            lblMessage.Text = "Failed!" + administrators.ErrorMessage;
                        }
                    }
                    else
                    {
                        pnlErrorMessage.Attributes.Remove("class");
                        pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                        pnlErrorMessage.Visible             = true;
                        lblMessage.Text = "Failed!" + invitations.ErrorMessage;
                    }
                }
                else
                {
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text = "Oops!! You cannot create the admin because admin already exists in the database. Please try with different emailid.";
                }
            }
            catch (Exception ex)
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = ex.Message;
            }
        }
Ejemplo n.º 10
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string text = Globals.RequestFormStr("action");

            if (!string.IsNullOrEmpty(text))
            {
                if (text == "End")
                {
                    int num = Globals.RequestFormNum("delId");
                    if (num > 0)
                    {
                        if (ActivityHelper.EndAct(num))
                        {
                            context.Response.Write("{\"state\":\"true\",\"msg\":\"活动成功结束\"}");
                            return;
                        }
                        context.Response.Write("{\"state\":\"false\",\"msg\":\"活动结束失败\"}");
                        return;
                    }
                    else
                    {
                        context.Response.Write("{\"state\":\"false\",\"msg\":\"参数不正确\"}");
                    }
                }
                return;
            }
            try
            {
                int             num2       = int.Parse(context.Request["id"].ToString());
                string          text2      = context.Request["name"].ToString();
                string          val        = context.Request["begin"].ToString();
                string          val2       = context.Request["end"].ToString();
                string          text3      = context.Request["memberlvl"].ToString();
                string          text4      = context.Request["defualtGroup"].ToString();
                string          text5      = context.Request["customGroup"].ToString();
                string          val3       = context.Request["maxNum"].ToString();
                string          val4       = context.Request["type"].ToString();
                string          val5       = context.Request["attendType"].ToString();
                string          val6       = context.Request["meetType"].ToString();
                int             attendType = 0;
                int             meetType   = 0;
                System.DateTime now        = System.DateTime.Now;
                System.DateTime now2       = System.DateTime.Now;
                int             attendTime = 0;
                int             num3       = 0;
                if (text2.Length > 30)
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"活动名称不能超过30个字符\"}");
                }
                else if (!val.bDate(ref now))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"请输入正确的开始时间\"}");
                }
                else if (!val2.bDate(ref now2))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"请输入正确的结束时间\"}");
                }
                else if (now2 < now)
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"结束时间不能早于开始时间\"}");
                }
                else if (string.IsNullOrEmpty(text3) && string.IsNullOrEmpty(text4) && string.IsNullOrEmpty(text5))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"请选择适用会员等级\"}");
                }
                else if (!val3.bInt(ref attendTime))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"请选择参与次数\"}");
                }
                else if (!val4.bInt(ref num3))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"请选择参与商品类型\"}");
                }
                else if (!val5.bInt(ref attendType))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"请选择优惠类型\"}");
                }
                else if (!val6.bInt(ref meetType))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"请选择优惠条件\"}");
                }
                else
                {
                    System.Collections.Generic.List <ActivityDetailInfo> list = new System.Collections.Generic.List <ActivityDetailInfo>();
                    JArray jArray = (JArray)JsonConvert.DeserializeObject(context.Request.Form["stk"].ToString());
                    if (jArray.Count > 1)
                    {
                        for (int i = 0; i < jArray.Count - 1; i++)
                        {
                            JToken jToken = jArray[i]["meet"];
                            for (int j = i + 1; j < jArray.Count; j++)
                            {
                                if (jArray[j]["meet"] == jToken)
                                {
                                    context.Response.Write("{\"type\":\"error\",\"data\":\"多级优惠的各级满足金额不能相同\"}");
                                    return;
                                }
                            }
                        }
                    }
                    if (jArray.Count > 0)
                    {
                        for (int k = 0; k < jArray.Count; k++)
                        {
                            ActivityDetailInfo activityDetailInfo = new ActivityDetailInfo();
                            string             val7  = jArray[k]["meet"].ToString();
                            string             val8  = jArray[k]["meetNumber"].ToString();
                            string             val9  = jArray[k]["redus"].ToString();
                            string             val10 = jArray[k]["free"].ToString();
                            string             val11 = jArray[k]["point"].ToString();
                            string             val12 = jArray[k]["coupon"].ToString();
                            decimal            num4  = 0m;
                            int     num5             = 0;
                            decimal num6             = 0m;
                            int     integral         = 0;
                            int     couponId         = 0;
                            int     num7             = 0;
                            if (!val8.bInt(ref num5))
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"第" + (k + 1).ToString() + "级优惠满足次数输入错误!\"}");
                                return;
                            }
                            if (!val7.bDecimal(ref num4))
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"第" + (k + 1).ToString() + "级优惠满足金额输入错误!\"}");
                                return;
                            }
                            if (!val9.bDecimal(ref num6))
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"第" + (k + 1).ToString() + "级优惠减免金额输入错误!\"}");
                                return;
                            }
                            if (!val10.bInt(ref num7))
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"第" + (k + 1).ToString() + "级优惠免邮选择错误!\"}");
                                return;
                            }
                            bool bFreeShipping = num7 != 0;
                            if (!val11.bInt(ref integral))
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"第" + (k + 1).ToString() + "级优惠积分输入错误!\"}");
                                return;
                            }
                            if (!val11.bInt(ref integral))
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"第" + (k + 1).ToString() + "级优惠积分输入错误!\"}");
                                return;
                            }
                            if (!val12.bInt(ref couponId))
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"第" + (k + 1).ToString() + "级优惠优惠券选择错误!\"}");
                                return;
                            }
                            if (num5 == 0 && num6 > num4)
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"第" + (k + 1).ToString() + "级优惠减免金额不能大于满足金额!\"}");
                                return;
                            }
                            activityDetailInfo.ActivitiesId   = 0;
                            activityDetailInfo.bFreeShipping  = bFreeShipping;
                            activityDetailInfo.CouponId       = couponId;
                            activityDetailInfo.MeetMoney      = num4;
                            activityDetailInfo.MeetNumber     = num5;
                            activityDetailInfo.ReductionMoney = num6;
                            activityDetailInfo.Integral       = integral;
                            list.Add(activityDetailInfo);
                        }
                    }
                    ActivityInfo activityInfo = new ActivityInfo();
                    if (num2 != 0)
                    {
                        activityInfo = ActivityHelper.GetAct(num2);
                        if (activityInfo == null)
                        {
                            context.Response.Write("{\"type\":\"error\",\"data\":\"没有找到这个活动\"}");
                            return;
                        }
                    }
                    activityInfo.ActivitiesName = text2;
                    activityInfo.EndTime        = now2.Date.AddDays(1.0).AddSeconds(-1.0);
                    activityInfo.StartTime      = now.Date;
                    activityInfo.attendTime     = attendTime;
                    activityInfo.attendType     = attendType;
                    activityInfo.isAllProduct   = (num3 == 0);
                    activityInfo.MemberGrades   = text3;
                    activityInfo.DefualtGroup   = text4;
                    activityInfo.CustomGroup    = text5;
                    activityInfo.Type           = new int?(0);
                    activityInfo.MeetMoney      = 0m;
                    activityInfo.ReductionMoney = 0m;
                    activityInfo.Details        = list;
                    activityInfo.MeetType       = meetType;
                    string str = "";
                    int    num8;
                    if (num2 == 0)
                    {
                        num8 = ActivityHelper.Create(activityInfo, ref str);
                    }
                    else
                    {
                        num8 = activityInfo.ActivitiesId;
                        if (!ActivityHelper.Update(activityInfo, ref str))
                        {
                            num8 = 0;
                        }
                    }
                    if (num8 > 0)
                    {
                        context.Response.Write("{\"type\":\"success\",\"data\":\"" + num8.ToString() + "\"}");
                    }
                    else
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"" + str + "\"}");
                    }
                }
            }
            catch (System.Exception ex)
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"" + ex.Message + "\"}");
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Invitations    _invitation     = bInvitations.List().Where(m => m.Invitation_EmailId == txtEmailId.Text).FirstOrDefault();
                Administrators _administrators = bAdministrator.List().Where(m => m.EmailId == txtEmailId.Text).FirstOrDefault();
                if (_invitation == null && _administrators == null)
                {
                    Invitations invitations = new Invitations()
                    {
                        Store_Id               = Convert.ToInt32(ddlStore.SelectedValue),
                        Invitation_Code        = Guid.NewGuid().ToString(),
                        Invitation_EmailId     = txtEmailId.Text,
                        Invitation_CreatedDate = DateTime.Now,
                        Invitation_Status      = eStatus.Active.ToString(),
                        Role = ddlRole.Text,
                        Invitation_UpdatedDate = DateTime.Now,
                        Send_Activity_Mail     = (chkGetActivityMail.Checked) ? 1 : 0
                    };

                    invitations = bInvitations.Create(invitations);
                    ActivityHelper.Create("New Invitation", "New Invitation Created On " +
                                          DateTime.Now.ToString("D") + " Successfully, for EmailId " + invitations.Invitation_EmailId + ".",
                                          Convert.ToInt32(Session[ConfigurationSettings.AppSettings["AdminSession"].ToString()].ToString()));

                    if (String.IsNullOrEmpty(invitations.ErrorMessage))
                    {
                        if (Convert.ToBoolean(ConfigurationSettings.AppSettings["IsEmailEnable"]))
                        {
                            txtEmailId.Text        = "";
                            ddlRole.SelectedIndex  = 0;
                            ddlStore.SelectedIndex = 0;
                            string host = ConfigurationSettings.AppSettings["DomainUrl"].ToString();
                            host = host + "account/invitation.aspx?code=" + invitations.Invitation_Code + "&emailid=" + invitations.Invitation_EmailId;
                            string body = MailHelper.InvitationLink(host);
                            MailHelper.SendEmail(invitations.Invitation_EmailId, "Hurray!!! You Are Invited To Rachna Teracotta.", body, "Rachna Teracotta Invitation");
                            pnlErrorMessage.Attributes.Remove("class");
                            pnlErrorMessage.Attributes["class"] = "alert alert-success alert-dismissable";
                            pnlErrorMessage.Visible             = true;
                            lblMessage.Text = "Success! New Invitation Successfully.";
                        }
                        else
                        {
                            txtEmailId.Text        = "";
                            ddlRole.SelectedIndex  = 0;
                            ddlStore.SelectedIndex = 0;
                            pnlErrorMessage.Attributes.Remove("class");
                            pnlErrorMessage.Attributes["class"] = "alert alert-success alert-dismissable";
                            pnlErrorMessage.Visible             = true;
                            lblMessage.Text = "Success! New Invitation Successfully.";
                        }
                    }
                    else
                    {
                        pnlErrorMessage.Attributes.Remove("class");
                        pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                        pnlErrorMessage.Visible             = true;
                        lblMessage.Text = "Failed!" + invitations.ErrorMessage;
                    }

                    _invitation = null;
                    invitations = null;
                }
                else
                {
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text = "Oops!! Invitation cannot be created, because entered email id already exists in the database.";
                }
            }
            catch (Exception ex)
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = ex.InnerException.InnerException.Message;
            }
        }
Ejemplo n.º 12
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                int        id        = Convert.ToInt32(hdnCatId.Value);
                Categories _otherCat = bCategory.List().Where(m => m.Category_Id != id && m.Category_Title == txtCategory.Text).FirstOrDefault();
                int        adminId   = Convert.ToInt32(Session[ConfigurationSettings.AppSettings["AdminSession"].ToString()].ToString());
                if (_otherCat == null)
                {
                    Categories Categories = bCategory.List().Where(m => m.Category_Id == id).FirstOrDefault();
                    Categories.Category_Title       = txtCategory.Text;
                    Categories.Category_UpdatedDate = DateTime.Now;
                    Categories.Administrators_Id    = adminId;
                    Categories.Category_Status      = (chkIsActive.Checked) ? eStatus.Active.ToString() : eStatus.InActive.ToString();
                    if (imgInp.HasFile)
                    {
                        Categories.Category_Photo = "files/category/" + "Category_" + Categories.Category_Id + ".png";
                        string   path = Server.MapPath("../" + Categories.Category_Photo);
                        FileInfo file = new FileInfo(path);
                        if (file.Exists)//check file exsit or not
                        {
                            file.Delete();
                        }
                        Upload(Categories.Category_Id);
                    }

                    Categories = bCategory.Update(Categories);

                    if (string.IsNullOrEmpty(Categories.ErrorMessage) && Categories.Category_Status == eStatus.InActive.ToString())
                    {
                        List <SubCategories> subCategories = new List <SubCategories>();
                        List <Product>       products      = new List <Product>();
                        subCategories = bSubCategory.List().Where(m => m.Category_Id == Categories.Category_Id && m.SubCategory_Status == eStatus.Active.ToString()).ToList();
                        foreach (var item113 in subCategories)
                        {
                            List <Product> productsTemp = new List <Product>();
                            productsTemp = bProduct.List().Where(m => m.Product_Status == eProductStatus.Published.ToString() && m.SubCategory.SubCategory_Id == item113.SubCategory_Id).ToList();
                            products.AddRange(productsTemp);
                        }

                        foreach (var item in products)
                        {
                            item.Product_Status = eProductStatus.ReviewPending.ToString();
                            bProduct.Update(item);
                            ProductHelper.CreateProductFlow(item.Product_Id, item.Product_Title, adminId, "System", "Category In Active : Product Updated and set to Review Pending Status", item.Product_Status);
                            bProduct.DeleteTopEight(item.Product_Id);
                            bProduct.DeleteProductFeature(item.Product_Id);
                            bProduct.DeleteCart(item.Product_Id);
                        }
                    }

                    ActivityHelper.Create("Update Category", "New Category Updated On " + DateTime.Now.ToString("D") + " Successfully and Title is " + Categories.Category_Title + ".", adminId);

                    Response.Redirect("/administration/categories/category.aspx?id=2000&redirecturl=admin-category-RachnaTeracotta");
                }
                else
                {
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text = "Oops!! Category not updated successfully, category name should not be same as other";
                }
            }
            catch (Exception ex)
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = ex.InnerException.InnerException.Message;
            }
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                Administrators _admin = bAdministrator.List().Where(m => m.EmailId == txtUserName.Text).FirstOrDefault();

                if (_admin == null)
                {
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblErrorMessage.Text = "Oops!!! No entered email id exists in our database.";
                }
                else if (_admin.Admin_Status == "inactive")
                {
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblErrorMessage.Text = "Oops!!! Cannot login to your account, becaues your account is inactive. Please raise request to activate your account.";
                }
                else if (_admin.Admin_Login_Attempt > 5)
                {
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblErrorMessage.Text = "Oops!!! Cannot login to your account, becaues your account is locked. Please raise request to unlock your account.";
                }
                else if (_admin.Password != txtPassword.Text && _admin.Admin_Login_Attempt < 5)
                {
                    _admin.Admin_Login_Attempt = (_admin.Admin_Login_Attempt + 1);
                    _admin.Admin_UpdatedDate   = DateTime.Now;
                    _admin = bAdministrator.Update(_admin);
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblErrorMessage.Text = "Oops!!! Entered password is invalid for entered emailid.";
                }
                else
                {
                    ActivityHelper.Create("Login", "Loogged In on " + DateTime.Now.ToString("D") + " Successfully", _admin.Administrators_Id);
                    pnlErrorMessage.Visible = false;
                    lblErrorMessage.Text    = "";
                    if (_admin.Admin_Role != eRole.Vendor.ToString())
                    {
                        Session[ConfigurationSettings.AppSettings["SupportSession"].ToString()] = _admin.Administrators_Id;
                        if (_admin.Admin_Login_Attempt != 0)
                        {
                            _admin.Admin_Login_Attempt = 0;
                            _admin.Admin_UpdatedDate   = DateTime.Now;
                            _admin = bAdministrator.Update(_admin);
                        }
                        if (Session["PreviousUrl"] != null)
                        {
                            Response.Redirect(Session["PreviousUrl"].ToString(), false);
                        }
                        else
                        {
                            Response.Redirect("/support/home/default.aspx?redirecturl=rachna-teracotta-home");
                        }
                    }
                    else
                    {
                        pnlErrorMessage.Attributes.Remove("class");
                        pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                        pnlErrorMessage.Visible             = true;
                        lblErrorMessage.Text = "Oops!! You are not authorized user to access this page.";
                    }
                }
            }
            catch (Exception ex)
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblErrorMessage.Text = "Oops!! Server error occured, please contact administrator.";
            }
        }