protected void btnDeleteJustThis_Click(object sender, EventArgs e) { try { ViewModel.tblAttachCrmInterface AttachCrmInterface = new ViewModel.tblAttachCrmInterface(); AttachCrmInterface.IDAttachCrmInterface = hfIDAttachCrmInterface.Value.StringToGuid(); bool ret = bisAttachCrmInterfaceMethod.DeleteJustThisAttachCrmInterfaceByUserForAttachSite(AttachCrmInterface); if (ret) { fillGrdAttachCrmInterface(hfIDRet.Value, hfPartName.Value); fillgrdAttachSite(); NewFiledsAttachSite(); ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "myscr", "$('#" + ModalDeleteWays.ClientID + "').modal('hide');$('#" + ModalDeleteWays.ClientID + "').css('overflow','hidden')", true); ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "er2", " 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(), "er3", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'>اشکال در حذف اطلاعات!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true); } } catch (Exception) { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "er4", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'>اشکال در برقراری ارتباط با دیتابیس!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true); } }
protected void btnDeleteAll_Click(object sender, EventArgs e) { try { ViewModel.Search getAttachCrmInterface = new ViewModel.Search(); getAttachCrmInterface.Filter = " and tblAttachCrmInterface.IDAttachCrmInterface = '" + hfIDAttachCrmInterface.Value + "'"; DataSet ds = bisAttachCrmInterfaceMethod.GetAttachCrmInterfaceData_getUrlForDeleteInAttachSite(getAttachCrmInterface); string root = HostingEnvironment.ApplicationPhysicalPath; string filePath = root + ds.ReturnDataSetField("Url"); if (filePath == "") { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "er1", " 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.tblAttachCrmInterface AttachCrmInterface = new ViewModel.tblAttachCrmInterface(); AttachCrmInterface.IDAttachCrmInterface = hfIDAttachCrmInterface.Value.StringToGuid(); bool ret = bisAttachCrmInterfaceMethod.DeleteAllAttachCrmInterfaceByUserForAttachSite(AttachCrmInterface); if (ret) { File.Delete(filePath); fillGrdAttachCrmInterface(hfIDRet.Value, hfPartName.Value); fillgrdAttachSite(); NewFiledsAttachSite(); ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "myscr", "$('#" + ModalDeleteWays.ClientID + "').modal('hide');$('#" + ModalDeleteWays.ClientID + "').css('overflow','hidden')", true); ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "er2", " 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(), "er3", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'>اشکال در حذف اطلاعات!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true); } } catch (Exception) { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "er4", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'>اشکال در برقراری ارتباط با دیتابیس!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true); } }
public bool DeleteJustThisAttachCrmInterfaceByUserForAttachSite(ViewModel.tblAttachCrmInterface AttachCrmInterface) { return(sqlHelper.RunProcedure("sp_tblAttachCrmInterface_DeleteJustThisRowByUserForAttachSite", AttachCrmInterface) > 0); }
public bool AttachCrmInterface_Insert_FromLastFiles(ViewModel.tblAttachCrmInterface AttachCrmInterface) { return(sqlHelper.RunProcedure("sp_tblAttachCrmInterface_Insert_FromLastFiles", AttachCrmInterface) > 0); }
protected void btnAddAttachSiteFromLastFiles_Click(object sender, EventArgs e) { try { bool check = checkAccess(EventName.ListofEvents.SelectOldAttchForProduct.ToString()); if (!check) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMessage", "alert('شما به این رویداد اجازه دسترسی ندارید!');", true); return; } string str = ""; int count = 0; foreach (GridViewRow gr in grdAttachSiteFiles.Rows) { if (((CheckBox)gr.FindControl("chkSelect")).Checked) { if (count != 0) { str += " or "; } count++; str += " IDAttachSite = '" + ((HiddenField)gr.FindControl("hfIDAttachSite")).Value + "' "; } } if (count != 0) { ViewModel.Search AttachCrmInterfaceRepeatSearch = new ViewModel.Search(); AttachCrmInterfaceRepeatSearch.Filter = "(" + str + ") and IDRet = '" + hfIDRet.Value + "' "; DataSet dsRepeatFile = bisAttachCrmInterfaceMethod.GetAttachCrmInterface_GetData_CheckRepeat(AttachCrmInterfaceRepeatSearch); if (dsRepeatFile.Tables[0].Rows.Count == 0) { ViewModel.tblAttachCrmInterface newAttachCrmInterface = new ViewModel.tblAttachCrmInterface(); newAttachCrmInterface.AttachSiteCondition = str; newAttachCrmInterface.IDRet = hfIDRet.Value.StringToGuid(); bool ret = bisAttachCrmInterfaceMethod.AttachCrmInterface_Insert_FromLastFiles(newAttachCrmInterface); if (ret) { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "er1", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'>اطلاعات ثبت شد!</p>\",title: \"<p style='text-align:right;direction:rtl'>ثبت اطلاعات</p>\"});", true); fillGrdAttachCrmInterface(hfIDRet.Value, hfPartName.Value); NewFiledsAttachSite(); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "er2", " 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(), "er3", " 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(), "er4", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'>لطفا یک یا چند فایل را انتخاب نمایید!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true); } } catch (Exception) { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "er5", " bootbox.alert({message: \"<p dir='rtl' style='color:#004179;font-size:17px;'>اشکال در برقراری ارتباط با دیتابیس!</p>\",title: \"<p style='text-align:right;direction:rtl'>خطا</p>\"});", true); } }