Example #1
0
 public bool DeleteDetailTechnicalProperty(ViewModel.tblDetailTechnicalProperty DetailTechnicalProperty)
 {
     return(sqlHelper.RunProcedure("sp_tblDetailTechnicalProperty_DeleteRow", DetailTechnicalProperty) > 0);
 }
Example #2
0
        protected void btnAddDetailTechnicalProperty_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (hfTechnicalPropertyAutoComplete.Value == Guid.Empty.ToString() || hfTechnicalPropertyAutoComplete.Value == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert(' ویژگی فنی را از لیست انتخاب کنید!');", true);
                    return;
                }
                if (txtTechnicalValue_En.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert(' مقدار ویژگی فنی(En) را وارد کنید!');", true);
                    return;
                }


                ViewModel.tblDetailTechnicalProperty newDetailTechnicalProperty = new ViewModel.tblDetailTechnicalProperty();
                newDetailTechnicalProperty.Value_Fa            = txtTechnicalValue_Fa.Text.FixFarsi();
                newDetailTechnicalProperty.Value_En            = txtTechnicalValue_En.Text.FixFarsi();
                newDetailTechnicalProperty.IDRet               = hfIDRet.Value.StringToGuid();
                newDetailTechnicalProperty.IDUser              = IDUser;
                newDetailTechnicalProperty.CreateDate          = DateTime.Now;
                newDetailTechnicalProperty.IDTechnicalProperty = hfTechnicalPropertyAutoComplete.Value.StringToGuid();
                newDetailTechnicalProperty.Status              = 1;
                newDetailTechnicalProperty.Order               = txtOrderTechnicalProperty.Text.StringToInt();
                switch (hfModeDetailTechnicalProperty.Value)
                {
                case "New":
                    try
                    {
                        bool check = SqlHelper.CheckAccess(EventName.ListofEvents.AddDetailTechnicalProperty.ToString(), IDUser);
                        if (!check)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('شما به این رویداد اجازه دسترسی ندارید!');", true);
                            return;
                        }

                        newDetailTechnicalProperty.IDDetailTechnicalProperty = Guid.NewGuid();
                        if (checkTechnicalProperty(hfTechnicalPropertyAutoComplete.Value.StringToGuid(), hfIDDetailTechnicalProperty.Value.StringToGuid()))
                        {
                            bool ret = BisDetailTechnicalProperty.AddDetailTechnicalProperty(newDetailTechnicalProperty);
                            if (ret)
                            {
                                hfIDDetailTechnicalProperty.Value = newDetailTechnicalProperty.IDDetailTechnicalProperty.ToString();
                                fillGrdDetailTechnicalProperty(hfIDRet.Value.StringToGuid());
                                newFieldsDetailTechnicalProperty();

                                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "OkMessage", "alert('اطلاعات ثبت شد!');", true);
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('اشکال در ثبت اطلاعات!');", true);
                            }
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert(' برای این محصول با این عنوان ویژگی قبلا ثبت شده است !');", true);
                        }
                    }
                    catch
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط با دیتابیس!');", true);
                    }

                    break;

                case "Edit":
                    try
                    {
                        bool check = SqlHelper.CheckAccess(EventName.ListofEvents.EditDetailTechnicalProperty.ToString(), IDUser);
                        if (!check)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('شما به این رویداد اجازه دسترسی ندارید!');", true);
                            return;
                        }
                        newDetailTechnicalProperty.IDDetailTechnicalProperty = hfIDDetailTechnicalProperty.Value.StringToGuid();
                        if (checkTechnicalProperty(hfTechnicalPropertyAutoComplete.Value.StringToGuid(), hfIDDetailTechnicalProperty.Value.StringToGuid()))
                        {
                            bool result = BisDetailTechnicalProperty.UpdateDetailTechnicalProperty(newDetailTechnicalProperty);
                            if (result)
                            {
                                fillGrdDetailTechnicalProperty(hfIDRet.Value.StringToGuid());
                                newFieldsDetailTechnicalProperty();

                                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "OkMessage", "alert('اطلاعات ویرایش شد!');", true);
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('اشکال در ویرایش اطلاعات!');", true);
                            }
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert(' برای این محصول با این عنوان ویژگی قبلا ثبت شده است !');", true);
                        }
                    }
                    catch
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط با دیتابیس!');", true);
                    }

                    break;
                }
            }
        }
Example #3
0
 public bool AddDetailTechnicalProperty(ViewModel.tblDetailTechnicalProperty DetailTechnicalProperty)
 {
     return(sqlHelper.RunProcedure("sp_tblDetailTechnicalProperty_Insert", DetailTechnicalProperty) > 0);
 }
Example #4
0
        protected void grdDetailTechnicalProperty_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Guid IDDetailTechnicalProperty = e.CommandArgument.ToString().StringToGuid();

            switch (e.CommandName)
            {
            case "Edit":
                try
                {
                    hfIDDetailTechnicalProperty.Value = IDDetailTechnicalProperty.ToString();
                    ViewModel.Search DetailTechnicalPropertySearch = new ViewModel.Search();
                    DetailTechnicalPropertySearch.Filter = " and tblDetailTechnicalProperty.IDDetailTechnicalProperty ='" + IDDetailTechnicalProperty + "'";

                    DataSet ds = BisDetailTechnicalProperty.GetDetailTechnicalPropertyData(DetailTechnicalPropertySearch);
                    if (!ds.Null_Ds())
                    {
                        txtTechnicalValue_Fa.Text             = ds.ReturnDataSetField("Value_Fa");
                        txtTechnicalValue_En.Text             = ds.ReturnDataSetField("Value_En");
                        hfTechnicalPropertyAutoComplete.Value = ds.ReturnDataSetField("IDTechnicalProperty");
                        txtTechnicalProperty.Text             = ds.ReturnDataSetField("TechnicalPropertyCodeName_En");

                        hfIDDetailTechnicalProperty.Value   = ds.ReturnDataSetField("IDDetailTechnicalProperty");
                        hfModeDetailTechnicalProperty.Value = "Edit";
                        txtOrderTechnicalProperty.Text      = ds.ReturnDataSetField("Order");
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('اشکال در واکشی اطلاعات!');", true);
                    }
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط با دیتابیس!');", true);
                }
                break;

            case "Delete":

                try
                {
                    bool check = SqlHelper.CheckAccess(EventName.ListofEvents.DeleteDetailTechnicalProperty.ToString(), IDUser);
                    if (!check)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('شما به این رویداد اجازه دسترسی ندارید!');", true);
                        return;
                    }
                    ViewModel.tblDetailTechnicalProperty DeleteDetailTechnicalProperty = new ViewModel.tblDetailTechnicalProperty();
                    DeleteDetailTechnicalProperty.IDDetailTechnicalProperty = IDDetailTechnicalProperty;

                    bool retDel = BisDetailTechnicalProperty.DeleteDetailTechnicalProperty(DeleteDetailTechnicalProperty);
                    if (retDel)
                    {
                        fillGrdDetailTechnicalProperty(hfIDRet.Value.StringToGuid());
                        newFieldsDetailTechnicalProperty();
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('حذف اطلاعات با موفقیت انجام شد!');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('اشکال در حذف اطلاعات!');", true);
                    }
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط با دیتابیس!');", true);
                }
                break;
            }
        }