//private void SaveInsightSupplieMerchSupplierParent(int insightSupplierId) //{ // InsightSupplierMerchSupplierLink iSMSL = new InsightSupplierMerchSupplierLink(); // iSMSL.InsightSupplierId = insightSupplierId; // iSMSL.SupplierParentId = Convert.ToInt32(DropDownListSupplierParentList.SelectedValue); // iSMSL.ModifiedUser = Context.User.Identity.GetUserName(); // iSMSL.Save(); //} private void SaveSupplier() { //if (Page.IsValid) //{ try { LabelError.Text = ""; string modifiedUser = Context.User.Identity.GetUserName(); InsightSupplierMerchandising insightSupplierMerchandising = new InsightSupplierMerchandising(); InsightSupplier.DeleteInsightSupplierMerchandisingByInsightSupplierIdAndSupplierId(Convert.ToInt32(ViewState["InsightSupplierId"]), Convert.ToInt32(ViewState["SupplierId"])); foreach (GridViewRow gridViewRow in GridViewResultSupplier.Rows) { HiddenField hiddenFieldSupplierSupplierId = (HiddenField)gridViewRow.Cells[0].FindControl("HiddenFieldSupplierSupplierId"); HiddenField hiddenFieldSupplierGroupId = (HiddenField)gridViewRow.Cells[1].FindControl("HiddenFieldSupplierGroupId"); HiddenField hiddenFieldSupplierMerchId = (HiddenField)gridViewRow.Cells[2].FindControl("HiddenFieldSupplierMerchId"); CheckBox checkBoxSupplierMerchandisingSelected = (CheckBox)gridViewRow.Cells[4].FindControl("CheckBoxSupplierMerchandisingSelected"); if (checkBoxSupplierMerchandisingSelected.Checked) { insightSupplierMerchandising.InsightSupplierId = Convert.ToInt32(ViewState["InsightSupplierId"]); insightSupplierMerchandising.SupplierParentId = 0; insightSupplierMerchandising.SupplierId = Convert.ToInt32(hiddenFieldSupplierSupplierId.Value); //insightSupplierMerchandising.CustomSupplierId = TextBoxCustomSupplierId.Text; insightSupplierMerchandising.GroupId = Convert.ToInt32(hiddenFieldSupplierGroupId.Value); insightSupplierMerchandising.MerchId = Convert.ToInt32(hiddenFieldSupplierMerchId.Value); insightSupplierMerchandising.IsIncluded = 1;//(RadioButtonInclusion.Checked == true) ? 1 : 2; insightSupplierMerchandising.ModifiedUser = modifiedUser; insightSupplierMerchandising.Save(); } else { insightSupplierMerchandising.InsightSupplierId = Convert.ToInt32(ViewState["InsightSupplierId"]); insightSupplierMerchandising.SupplierParentId = 0; insightSupplierMerchandising.SupplierId = Convert.ToInt32(hiddenFieldSupplierSupplierId.Value); //insightSupplierMerchandising.CustomSupplierId = "Reset"; insightSupplierMerchandising.GroupId = Convert.ToInt32(hiddenFieldSupplierGroupId.Value); insightSupplierMerchandising.MerchId = Convert.ToInt32(hiddenFieldSupplierMerchId.Value); insightSupplierMerchandising.IsIncluded = 2;//(RadioButtonInclusion.Checked == true) ? 1 : 2; insightSupplierMerchandising.ModifiedUser = modifiedUser; insightSupplierMerchandising.Save(); } } } catch (System.Data.SqlClient.SqlException sqlEx) { LabelError.Text = ""; for (int i = 0; i < sqlEx.Errors.Count; i++) { LabelError.Text += (sqlEx.Errors[i].Message + "<br />"); } PanelError.Visible = true; } //} }
protected void GridViewLinkedSupplier_RowCommand(object sender, GridViewCommandEventArgs e) { try { switch (e.CommandName.ToLower()) { case "viewauthorization": { ViewState["SupplierId"] = Convert.ToInt32(e.CommandArgument); BindViewAuthorization(0); break; } case "viewcategories": { ViewState["SupplierId"] = Convert.ToInt32(e.CommandArgument); BindSupplierMerchandisingGridView(); break; } case "removeinsightsuppliermerchsupplierlink": { InsightSupplier.DeleteInsightSupplierMerchandisingByInsightSupplierIdAndSupplierId(Convert.ToInt32(ViewState["InsightSupplierId"]), Convert.ToInt32(ViewState["SupplierId"])); InsightSupplierMerchSupplierLink.DeleteInsightSupplierMerchSupplierLinkByInsightSupplierMerchSupplierLinkId(Convert.ToInt32(e.CommandArgument)); BindSupplierList(); BindLinkedSupplierGridView(); BindSupplierMerchandisingGridView(); CloseSupplierAuthorization(); CloseSupplierMerchandisingGridView(); break; } } } catch (System.Data.SqlClient.SqlException sqlEx) { LabelError.Text = ""; for (int i = 0; i < sqlEx.Errors.Count; i++) { LabelError.Text += (sqlEx.Errors[i].Message + "<br />"); } PanelError.Visible = true; } }
private void SaveSupplier() { if (Page.IsValid) { try { LabelError.Text = ""; string modifiedUser = Context.User.Identity.GetUserName(); InsightSupplierMerchandising insightSupplierMerchandising = new InsightSupplierMerchandising(); InsightSupplier.DeleteInsightSupplierMerchandisingByInsightSupplierIdAndSupplierId(this.insightSupplierId, Convert.ToInt32(DropDownListSupplierList.SelectedValue)); foreach (GridViewRow gridViewRow in GridViewResultSupplier.Rows) { HiddenField hiddenFieldSupplierSupplierId = (HiddenField)gridViewRow.Cells[0].FindControl("HiddenFieldSupplierSupplierId"); HiddenField hiddenFieldSupplierGroupId = (HiddenField)gridViewRow.Cells[1].FindControl("HiddenFieldSupplierGroupId"); HiddenField hiddenFieldSupplierMerchId = (HiddenField)gridViewRow.Cells[2].FindControl("HiddenFieldSupplierMerchId"); CheckBox checkBoxSupplierMerchandisingSelected = (CheckBox)gridViewRow.Cells[4].FindControl("CheckBoxSupplierMerchandisingSelected"); if (checkBoxSupplierMerchandisingSelected.Checked) { insightSupplierMerchandising.InsightSupplierId = insightSupplierId; insightSupplierMerchandising.SupplierParentId = 0; insightSupplierMerchandising.SupplierId = Convert.ToInt32(hiddenFieldSupplierSupplierId.Value); insightSupplierMerchandising.CustomSupplierId = ""; insightSupplierMerchandising.GroupId = Convert.ToInt32(hiddenFieldSupplierGroupId.Value); insightSupplierMerchandising.MerchId = Convert.ToInt32(hiddenFieldSupplierMerchId.Value); insightSupplierMerchandising.ModifiedUser = modifiedUser; insightSupplierMerchandising.Save(); } } } catch (System.Data.SqlClient.SqlException sqlEx) { LabelError.Text = ""; for (int i = 0; i < sqlEx.Errors.Count; i++) { LabelError.Text += (sqlEx.Errors[i].Message + "<br />"); } PanelError.Visible = true; } } }