コード例 #1
0
 protected void delPicPropertyEdit_Click(object sender, EventArgs e)
 {
     try
     {
         imagePropertyEdit.Visible = false;
         ScriptManager.RegisterStartupScript(this, GetType(), "aa", "$('.EditPro').css(\"display\", \"none\");clearFulPropertyEdit();", true);
         ViewModel.Search searchProperty = new ViewModel.Search();
         searchProperty.Filter = " and tblProperty.IDProperty = '" + hfIdProperty.Value + "'";
         DataSet dsProperty = BisProperty.GetPropertyData(searchProperty);
         string  PicUrl     = dsProperty.ReturnDataSetField("PicUrl");
         if (dsProperty.ReturnDataSetField("PicUrl") != "")
         {
             ViewModel.tblProperty updatePicUrl = new ViewModel.tblProperty();
             updatePicUrl.PicUrl     = "";
             updatePicUrl.IDProperty = hfIdProperty.Value.StringToGuid();
             bool ret = BisProperty.UpdatePicUrlProperty(updatePicUrl);
             if (ret)
             {
                 File.Delete(Server.MapPath("../" + PicUrl));
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در حذف عکس!');", true);
             }
         }
     }
     catch
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "OkMessage", "alert('اشکال در برقراری ارتباط با دیتابیس!');", true);
     }
 }
コード例 #2
0
 public bool DeleteProperty(ViewModel.tblProperty Property)
 {
     return(sqlHelper.RunProcedure("sp_tblProperty_DeleteRow", Property) > 0);
 }
コード例 #3
0
 public bool UpdatePicUrlProperty(ViewModel.tblProperty Property)
 {
     return(sqlHelper.RunProcedure("sp_tblProperty_UpdatePicUrl", Property) > 0);
 }
コード例 #4
0
 public bool AddProperty(ViewModel.tblProperty Property)
 {
     return(sqlHelper.RunProcedure("sp_tblProperty_Insert", Property) > 0);
 }
コード例 #5
0
 public DataSet GetCompleteChildProperty(ViewModel.tblProperty Property)
 {
     return(sqlHelper.returnDataSet("sp_tblProperty_GetCompleteChildProperty", Property));
 }
コード例 #6
0
        protected void btnDeleteProperty_Click(object sender, EventArgs e)
        {
            bool check = checkAccess(EventName.ListofEvents.DeleteProperty.ToString());

            if (!check)
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Succsess", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> شما به این رویداد اجازه دسترسی ندارید!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                return;
            }
            ViewModel.Search getAssignProperty = new ViewModel.Search();
            getAssignProperty.Filter = " and tblDetailAssignProperty.IDProperty = '" + hfIdProperty.Value + "'";
            DataSet dsAssignProperty = BisDetailAssignProperty.GetDetailAssignPropertyData(getAssignProperty);

            if (!dsAssignProperty.Null_Ds())
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Succsess", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'>این ویژگی به گروهی انتساب داده شده است. امکان حذف موجو نیست!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                return;
            }
            ViewModel.Search getRulePropertyProduct = new ViewModel.Search();
            getRulePropertyProduct.Filter = " and tblRulePropertyProduct.IDProperty = '" + hfIdProperty.Value + "'";
            DataSet dsRulePropertyProduct = BisRulePropertyProduct.GetRulePropertyProductData(getRulePropertyProduct);

            if (!dsRulePropertyProduct.Null_Ds())
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Succsess", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'>این ویژگی در تولید ترکیب محصولی استفاده شده است. امکان حذف موجو نیست!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                return;
            }

            ViewModel.tblProperty CheckProperty = new ViewModel.tblProperty();
            CheckProperty.IDProperty = hfIdProperty.Value.StringToGuid();
            DataSet dsCheckChilds = BisProperty.GetCompleteChildProperty(CheckProperty);

            if (dsCheckChilds.Tables[0].Select("IDProperty <> '" + hfIdProperty.Value + "'").Count() == 0)
            {
                ViewModel.tblProperty UpdateProperty = new ViewModel.tblProperty();
                try
                {
                    UpdateProperty.IDProperty = hfIdProperty.Value.StringToGuid();
                    ViewModel.Search searchProperty = new ViewModel.Search();
                    searchProperty.Filter = " and tblProperty.IDProperty = '" + hfIdProperty.Value + "'";
                    DataSet dsProperty = BisProperty.GetPropertyData(searchProperty);
                    string  picUrl     = dsProperty.ReturnDataSetField("PicUrl");
                    bool    ret        = BisProperty.DeleteProperty(UpdateProperty);
                    if (ret)
                    {
                        if (picUrl != "")
                        {
                            File.Delete(Server.MapPath("../" + picUrl));
                        }
                        filltvProperty();
                        txtPropertyEditTitle_Fa.Text = "";
                        txtPropertyEditTitle_En.Text = "";
                        txtPropertyEditSort.Text     = "";
                        tvProperty.ExpandAll();
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Succsess", "$('#ModalPropertyEvents').modal('hide'); bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> حذف اطلاعات با موفقیت انجام شد!</p>\",title: \"<p style='text-align:right;direction:rtl'>حذف اطلاعات</p>\"});", true);
                        ScriptManager.RegisterClientScriptBlock(this, GetType(), "myscr", "$('#ModalPropertyEvents').modal('hide');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Succsess", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> اشکال در حذف اطلاعات!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                    }
                }
                catch
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Succsess", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> اشکال در برقراری ارتباط با دیتابیس!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Succsess", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> ابتدا باید ویژگی های پایین دستی این ویژگی  حذف شوند!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
            }
        }
コード例 #7
0
        protected void btnEditProperty_Click(object sender, EventArgs e)
        {
            bool check = checkAccess(EventName.ListofEvents.EditProperty.ToString());

            if (!check)
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Succsess", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> شما به این رویداد اجازه دسترسی ندارید!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                return;
            }
            if (Page.IsValid)
            {
                if (txtPropertyEditTitle_En.Text == "")
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "s7", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> عنوان(En) را وارد کنید!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                    return;
                }

                ViewModel.Search SearchPropertyEdit = new ViewModel.Search();
                SearchPropertyEdit.Filter = " And tblProperty.IDProperty = '" + tvEditProperty.SelectedNode.Value + "'";
                DataSet dsSelectedPropertyEdit = BisProperty.GetPropertyData(SearchPropertyEdit);
                //if (!dsSelectedPropertyEdit.Null_Ds() && dsSelectedPropertyEdit.ReturnDataSetField("IDParent") != Guid.Empty.ToString())
                //{
                //    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Succsess", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> امکان انتقال آیتم به دسته انتخاب شده مهیا نیست !</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                //    return;
                //}


                ViewModel.tblProperty CheckProperty = new ViewModel.tblProperty();
                CheckProperty.IDProperty = hfIdProperty.Value.StringToGuid();
                DataSet dsCheckChilds = BisProperty.GetCompleteChildProperty(CheckProperty);
                if (dsCheckChilds.Tables[0].Select("IDProperty = '" + tvEditProperty.SelectedNode.Value + "'").Count() == 0)
                {
                    ViewModel.tblProperty UpdateProperty = new ViewModel.tblProperty();
                    UpdateProperty.Name_Fa        = txtPropertyEditTitle_Fa.Text.FixFarsi();
                    UpdateProperty.Name_En        = txtPropertyEditTitle_En.Text;
                    UpdateProperty.Description_Fa = "";
                    UpdateProperty.Description_En = txtPropertyEditDescription_En.Text;
                    UpdateProperty.IDParent       = tvEditProperty.SelectedNode.Value.StringToGuid();
                    UpdateProperty.Sort           = txtPropertyEditSort.Text.StringToInt();
                    UpdateProperty.PicUrl         = "";
                    UpdateProperty.Status         = 1;
                    try
                    {
                        string GenerateName = Guid.NewGuid().ToString();

                        ViewModel.Search searchProperty = new ViewModel.Search();
                        searchProperty.Filter = " and tblProperty.IDProperty = '" + hfIdProperty.Value + "'";
                        DataSet dsProperty = BisProperty.GetPropertyData(searchProperty);
                        if (hfFilelNameEdit.Value == "")
                        {
                            UpdateProperty.PicUrl = dsProperty.ReturnDataSetField("PicUrl");
                        }
                        else
                        {
                            string Prefix = hfFilelNameEdit.Value.Substring(hfFilelNameEdit.Value.IndexOf('.'), hfFilelNameEdit.Value.Length - hfFilelNameEdit.Value.IndexOf('.'));
                            if (Prefix == ".png" || Prefix == ".jpg" || Prefix == ".jpeg")
                            {
                                string url = "Picture/Property/" + GenerateName + Prefix;
                                UpdateProperty.PicUrl = url;
                            }
                            else
                            {
                                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Error", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> فایل باید با پسوند png یا jpg یا jpeg باشد!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                                return;
                            }
                        }
                        UpdateProperty.IDProperty = hfIdProperty.Value.StringToGuid();
                        bool ret = BisProperty.UpdateProperty(UpdateProperty);
                        if (ret)
                        {
                            filltvProperty();
                            txtPropertyTitle_Fa.Text = "";
                            txtPropertyTitle_En.Text = "";
                            tvProperty.ExpandAll();

                            if (hfFilelNameEdit.Value != "" && dsProperty.ReturnDataSetField("PicUrl") != "") //faile jadidi entekhab shode va ghablan ham file entekhab shode boode pas bayad ghabli pak shavad
                            {
                                File.Delete(Server.MapPath("../" + dsProperty.ReturnDataSetField("PicUrl")));
                            }
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "UploadFiles", "UploadFiles('" + FulPropertyEdit.ClientID + "','../Picture/Property/','" + GenerateName + "');", true);
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "s1", "$('#ModalPropertyEvents').modal('hide'); bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> ویرایش اطلاعات با موفقیت انجام شد!</p>\",title: \"<p style='text-align:right;direction:rtl'>ویرایش اطلاعات</p>\"});", true);
                            ScriptManager.RegisterClientScriptBlock(this, GetType(), "myscr", "$('#ModalPropertyEvents').modal('hide');", true);
                        }
                        else
                        {
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "s2", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> اشکال در ویرایش اطلاعات!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                        }
                    }
                    catch
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "s3", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> اشکال در برقراری ارتباط با دیتابیس!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "s4", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> انتخاب این ویژگی به عنوان ویژگی بالادستی امکان پذیر نیست!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                }
            }
        }
コード例 #8
0
        protected void btnAddSubProperty_Click(object sender, EventArgs e)
        {
            bool check = checkAccess(EventName.ListofEvents.AddProperty.ToString());

            if (!check)
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Succsess", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> شما به این رویداد اجازه دسترسی ندارید!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                return;
            }

            if (Page.IsValid)
            {
                if (txtPropertyTitle_En.Text == "")
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "s4", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> عنوان(En) را وارد کنید!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                    return;
                }
                //if (hfIdParentProperty.Value == "" || hfIdParentProperty.Value == Guid.Empty.ToString())
                //{
                if (hfIdParentProperty.Value == "")
                {
                    ViewModel.Search getProperty = new ViewModel.Search();
                    getProperty.Filter = " and tblProperty.IDParent = '" + Guid.Empty.ToString() + "' and tblProperty.Name_En='" + txtPropertyTitle_En.Text.Trim() + "'";
                    DataSet ds = BisProperty.GetPropertyData(getProperty);
                    if (!ds.Null_Ds())
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "s5", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> عنوان(En) تکراری است!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                        return;
                    }
                }

                if (hfIdParentProperty.Value == Guid.Empty.ToString())
                {
                    ViewModel.Search getProperty = new ViewModel.Search();
                    getProperty.Filter = " and tblProperty.IDParent = '" + hfIdProperty.Value + "' and tblProperty.Name_En='" + txtPropertyTitle_En.Text.Trim() + "'";
                    DataSet ds = BisProperty.GetPropertyData(getProperty);
                    if (!ds.Null_Ds())
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "s5", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> عنوان(En) تکراری است!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                        return;
                    }
                }


                ViewModel.tblProperty newProperty = new ViewModel.tblProperty();
                newProperty.Name_Fa        = txtPropertyTitle_Fa.Text.FixFarsi();
                newProperty.Name_En        = txtPropertyTitle_En.Text;
                newProperty.Description_Fa = "";
                newProperty.Description_En = txtPropertyDescription_En.Text;
                newProperty.IDParent       = hfIdProperty.Value.StringToGuid();
                newProperty.Sort           = txtPropertySort.Text.StringToInt();

                newProperty.Status = 1;
                try
                {
                    string GenerateName = Guid.NewGuid().ToString();
                    newProperty.IDProperty = Guid.NewGuid();
                    if (hfFilelName.Value != "")
                    {
                        string Prefix = hfFilelName.Value.Substring(hfFilelName.Value.IndexOf('.'), hfFilelName.Value.Length - hfFilelName.Value.IndexOf('.'));
                        if (Prefix == ".png" || Prefix == ".jpg" || Prefix == ".jpeg")
                        {
                            string url = "Picture/Property/" + GenerateName + Prefix;
                            newProperty.PicUrl = url;
                        }
                        else
                        {
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Error", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> فایل باید با پسوند png یا jpg یا jpeg باشد!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                            return;
                        }
                    }

                    bool ret = BisProperty.AddProperty(newProperty);
                    if (ret)
                    {
                        filltvProperty();
                        txtPropertyTitle_Fa.Text = "";
                        txtPropertyTitle_En.Text = "";
                        txtPropertySort.Text     = "";
                        tvProperty.ExpandAll();
                        ScriptManager.RegisterClientScriptBlock(this, GetType(), "UploadFiles", "UploadFiles('" + fulProperty.ClientID + "','../Picture/Property/','" + GenerateName + "');", true);
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "S1", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> اطلاعات با موفقیت ثبت شد!</p>\",title: \"<p style='text-align:right;direction:rtl'>ثبت اطلاعات</p>\"});", true);
                        ScriptManager.RegisterClientScriptBlock(this, GetType(), "myscr", "$('#ModalPropertyEvents').modal('hide');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "s2", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> اشکال در ثبت اطلاعات!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                    }
                }
                catch
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "s3", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> اشکال در برقراری ارتباط با دیتابیس!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);
                }

                //}
                //else
                //{
                //    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "s4", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'> امکان ثبت آیتم برای این دسته مهیا نیست !</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true);

                //}
            }
        }