protected void btnEditAccessoryCategory_Click(object sender, EventArgs e) { try { hfModeAccessoryCategory.Value = "Edit"; ViewModel.Search searchAccessoryCategory = new ViewModel.Search(); searchAccessoryCategory.Filter = " And tblAccessoryCategory.IDAccessoryCategory='" + hfIDAccessoryCategory.Value + "'"; DataSet ds = BisAccessoryCategory.GetAccessoryCategoryData(searchAccessoryCategory); if (!ds.Null_Ds()) { txtAccessoryName_En.Text = ds.ReturnDataSetField("Name_En"); txtAccessoryName_Fa.Text = ds.ReturnDataSetField("Name_Fa"); txtSort.Text = ds.ReturnDataSetField("Sort"); TreeDropDownEdit.SelectNode(ds.ReturnDataSetField("IDParent")); ScriptManager.RegisterClientScriptBlock(this, GetType(), "CloseModal", "$('#ModalNavigationOnAccessory').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); } }
public void NewFieldsAccessoryAccessory() { txtAccessoryName_Fa.Text = ""; txtAccessoryName_En.Text = ""; txtSort.Text = ""; TreeDropDownEdit.SelectNode(Guid.Empty.ToString()); hfModeAccessoryCategory.Value = "New"; hfIDAccessoryCategory.Value = ""; }
public void filltvAccessoryCategory() { try { GetSupplierName(IDSupplier); ViewModel.Search searchAccessoryCategory = new ViewModel.Search(); searchAccessoryCategory.Filter = " And tblAccessoryCategory.IDSupplier='" + IDSupplier + "'"; searchAccessoryCategory.Order = " Order By tblAccessoryCategory.[Sort]"; DataSet ds = BisAccessoryCategory.GetAccessoryCategoryData(searchAccessoryCategory); TreeDropDownEdit.filltvDropDown(ds, "IDAccessoryCategory"); tvAccessoryCategory.Nodes.Clear(); TreeNode newNode = new TreeNode("گروه های تعریف شده", Guid.Empty.ToString()); tvAccessoryCategory.Nodes.Add(newNode); BindTree(ds, newNode, "IDAccessoryCategory", tvAccessoryCategory); } 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); } }
protected void btnAddAccessoryCategory_Click(object sender, EventArgs e) { if (Page.IsValid) { ViewModel.tblAccessoryCategory newAccessoryCategory = new ViewModel.tblAccessoryCategory(); newAccessoryCategory.Name_Fa = txtAccessoryName_Fa.Text.FixFarsi(); newAccessoryCategory.Name_En = txtAccessoryName_En.Text; newAccessoryCategory.IDParent = TreeDropDownEdit.SelectedNode().StringToGuid(); newAccessoryCategory.Sort = txtSort.Text.StringToInt(); newAccessoryCategory.Status = 1; switch (hfModeAccessoryCategory.Value) { case "New": try { newAccessoryCategory.IDAccessoryCategory = Guid.NewGuid(); newAccessoryCategory.IDSupplier = IDSupplier; bool ret = BisAccessoryCategory.AddAccessoryCategory(newAccessoryCategory); if (ret) { hfIDAccessoryCategory.Value = newAccessoryCategory.IDAccessoryCategory.ToString(); filltvAccessoryCategory(); NewFieldsAccessoryAccessory(); ScriptManager.RegisterStartupScript(this, GetType(), "OkMessage", "alert('اطلاعات ثبت شد!');", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در ثبت اطلاعات!');", true); } } catch { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط با دیتابیس!');", true); } break; case "Edit": try { newAccessoryCategory.IDAccessoryCategory = hfIDAccessoryCategory.Value.StringToGuid(); bool result = BisAccessoryCategory.UpdateAccessoryCategory(newAccessoryCategory); if (result) { newAccessoryCategory.IDAccessoryCategory = hfIDAccessoryCategory.Value.StringToGuid(); filltvAccessoryCategory(); NewFieldsAccessoryAccessory(); ScriptManager.RegisterStartupScript(this, GetType(), "OkMessage", "alert('اطلاعات ویرایش شد!');", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در ویرایش اطلاعات!');", true); } } catch { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط با دیتابیس!');", true); } break; } } }