public bool DeleteTechnicalProperty(ViewModel.tblTechnicalProperty TechnicalProperty) { return(sqlHelper.RunProcedure("sp_tblTechnicalProperty_DeleteRow", TechnicalProperty) > 0); }
public bool UpdateTechnicalProperty(ViewModel.tblTechnicalProperty TechnicalProperty) { return(sqlHelper.RunProcedure("sp_tblTechnicalProperty_Update", TechnicalProperty) > 0); }
protected void btnAdd_Click(object sender, EventArgs e) { if (Page.IsValid) { if (ISExistTechnicalProperty()) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('خطا.ویژگی فنی وارد شده تکراری است!');", true); return; } ViewModel.tblTechnicalProperty newProperty = new ViewModel.tblTechnicalProperty(); newProperty.Name_Fa = txtName.Text.FixFarsi(); newProperty.Name_En = txtName_En.Text.FixFarsi(); newProperty.Status = 1; switch (hfMode.Value) { case "New": try { bool check = checkAccess(EventName.ListofEvents.AddDetailTechnicalProperty.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; } newProperty.IDTechnicalProperty = Guid.NewGuid(); if (checkProperty(txtName_En.Text.Trim())) { bool ret = BisTechnicalProperty.AddTechnicalProperty(newProperty); if (ret) { txtName.Text = txtName_En.Text = ""; hfMode.Value = "New"; hfIDTechnicalProperty.Value = newProperty.IDTechnicalProperty.ToString(); ScriptManager.RegisterStartupScript(this, GetType(), "OkMessage", "alert('اطلاعات ثبت شد!');", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در ثبت اطلاعات!');", true); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('ویژگی وارد شده تکراری می باشد!');", true); } } catch { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط با دیتابیس!');", true); } break; case "Edit": try { bool check = checkAccess(EventName.ListofEvents.EditDetailTechnicalProperty.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; } newProperty.IDTechnicalProperty = hfIDTechnicalProperty.Value.StringToGuid(); if (checkProperty(txtName_En.Text.Trim())) { bool result = BisTechnicalProperty.UpdateTechnicalProperty(newProperty); if (result) { txtName.Text = txtName_En.Text = ""; fillgrdTechnicalProperty(); hfMode.Value = "New"; ScriptManager.RegisterStartupScript(this, GetType(), "OkMessage", "alert('اطلاعات ویرایش شد!');", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در ویرایش اطلاعات!');", true); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('ویژگی وارد شده تکراری می باشد!');", true); } } catch { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط با دیتابیس!');", true); } break; } } }
public bool AddTechnicalProperty(ViewModel.tblTechnicalProperty TechnicalProperty) { return(sqlHelper.RunProcedure("sp_tblTechnicalProperty_Insert", TechnicalProperty) > 0); }
protected void grdTechnicalProperty_RowCommand(object sender, GridViewCommandEventArgs e) { Guid IDTechnicalProperty = e.CommandArgument.ToString().StringToGuid(); switch (e.CommandName) { case "Edit": try { hfIDTechnicalProperty.Value = IDTechnicalProperty.ToString(); ViewModel.Search PropertySearch = new ViewModel.Search(); PropertySearch.Filter = " and tblTechnicalProperty.IDTechnicalProperty ='" + IDTechnicalProperty + "'"; DataSet ds = BisTechnicalProperty.GetTechnicalPropertyData(PropertySearch); if (!ds.Null_Ds()) { txtName.Text = ds.ReturnDataSetField("Name_Fa"); txtName_En.Text = ds.ReturnDataSetField("Name_En"); hfMode.Value = "Edit"; divTable.Visible = false; divInfo.Visible = true; } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در واکشی اطلاعات!');", true); } } catch { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط با دیتابیس!');", true); } break; case "Delete": try { bool check = checkAccess(EventName.ListofEvents.DeleteDetailTechnicalProperty.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.tblTechnicalProperty DeleteProperty = new ViewModel.tblTechnicalProperty(); DeleteProperty.IDTechnicalProperty = IDTechnicalProperty; bool retDel = BisTechnicalProperty.DeleteTechnicalProperty(DeleteProperty); if (retDel) { fillgrdTechnicalProperty(); ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('حذف اطلاعات با موفقیت انجام شد!');", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در حذف اطلاعات!');", true); } } catch { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط با دیتابیس!');", true); } break; } }