public static int UpdateSetting(PTE objPTE) { int chkBit; List <SqlParameter> prm = new List <SqlParameter>(); try { using (DbManager DB = DbManager.GetDbManager()) { prm.Add(DB.MakeInParam("@PTEId", SqlDbType.Int, 4, objPTE.PteId)); prm.Add(DB.MakeInParam("@StateId", SqlDbType.Int, 4, objPTE.StateId)); prm.Add(DB.MakeInParam("@OrganizationSubTypeId", SqlDbType.Int, 4, objPTE.OrganizationSubTypeId)); prm.Add(DB.MakeInParam("@SizeId", SqlDbType.Int, 4, objPTE.SizeId)); prm.Add(DB.MakeInParam("@EffectiveDate", SqlDbType.DateTime, 8, objPTE.EffectiveDate)); prm.Add(DB.MakeInParam("@ExpirationDate", SqlDbType.DateTime, 8, objPTE.ExpirationDate)); prm.Add(DB.MakeInParam("@DollarValue", SqlDbType.Float, 8, objPTE.DollarValue)); prm.Add(DB.MakeInParam("@UpdatedDate", SqlDbType.DateTime, 8, objPTE.UpdatedDate)); prm.Add(DB.MakeInParam("@UpdatedByUserId", SqlDbType.Int, 4, objPTE.UpdatedByUserId)); prm.Add(DB.MakeOutParam("@bit", SqlDbType.Int, 4)); chkBit = DB.RunProc("up_PTE_Edit", prm.ToArray()); chkBit = Conversion.ParseInt(prm.Last <SqlParameter>().Value); } } catch (Exception ex) { chkBit = 0; new SqlLog().InsertSqlLog(0, "PTE.UpdateSetting", ex); } return(chkBit); }
public static int AddSettingProduct(PTE objPTE) { int checkBit; List <SqlParameter> prm = new List <SqlParameter>(); try { using (DbManager DB = DbManager.GetDbManager()) { prm.Add(DB.MakeInParam("@PteId", SqlDbType.Int, 4, objPTE.PteId)); prm.Add(DB.MakeInParam("@StateId", SqlDbType.Int, 4, objPTE.StateId)); prm.Add(DB.MakeInParam("@OrganizationSubTypeId", SqlDbType.Int, 0, objPTE.OrganizationSubTypeId)); prm.Add(DB.MakeInParam("@SizeId", SqlDbType.Int, 0, objPTE.SizeId)); //if (objPTE.ShapeId != 0) prm.Add(DB.MakeInParam("@ShapeId", SqlDbType.Int, 0, objPTE.ShapeId)); //else // prm.Add(DB.MakeInParam("@ShapeId", SqlDbType.Int, 0, DBNull.Value)); //if (objPTE.MaterialId != 0) prm.Add(DB.MakeInParam("@MaterialId", SqlDbType.Int, 0, objPTE.MaterialId)); //else // prm.Add(DB.MakeInParam("@MaterialId", SqlDbType.Int, 0, DBNull.Value)); prm.Add(DB.MakeInParam("@EffectiveDate", SqlDbType.DateTime, 0, objPTE.EffectiveDate)); prm.Add(DB.MakeInParam("@ExpirationDate", SqlDbType.DateTime, 0, objPTE.ExpirationDate)); prm.Add(DB.MakeInParam("@DollarValue", SqlDbType.Float, 0, objPTE.DollarValue)); prm.Add(DB.MakeInParam("@LanguageId", SqlDbType.Int, 0, objPTE.LanguageId)); prm.Add(DB.MakeInParam("@CreatedDate", SqlDbType.DateTime, 0, objPTE.CreatedDate)); prm.Add(DB.MakeInParam("@CreatedByUserId", SqlDbType.Int, 0, objPTE.CreatedByUserId)); // prm.Add(DB.MakeReturnParam(SqlDbType.Int, 0)); prm.Add(DB.MakeInParam("@CatId", SqlDbType.Int, 0, objPTE.ProductCategoryId)); prm.Add(DB.MakeInParam("@SubCatId", SqlDbType.Int, 0, objPTE.ProductSubCategoryId)); prm.Add(DB.MakeOutParam("@bit", SqlDbType.Int, 4)); checkBit = DB.RunProc("up_PTE_add_Product", prm.ToArray()); checkBit = Conversion.ParseInt(prm.Last <SqlParameter>().Value); } } catch (Exception ex) { checkBit = 0; new SqlLog().InsertSqlLog(0, "PTE.AddSettingProduct", ex); } return(checkBit); }
protected void gvSettingsProduct_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit") { //pteID = Convert.ToInt32(e.CommandArgument); hdnPTEId.Value = e.CommandArgument.ToString(); lblErrorMessage.Visible = false; } else if (e.CommandName == "Delete") { lblErrorMessage.Visible = false; PTE.DeleteSetting(Convert.ToInt32(e.CommandArgument), DateTime.Now, LoginMemberId); //LoadAllSetting(); loadGridFroProduct(); Response.Redirect("Settings"); } else if (e.CommandName == "AddMore") { // LinkButton lnkbtnAddMore = gvSettings.FooterRow.FindControl("lnkbtnAddMore") as LinkButton; LinkButton lnkbtnAddMoreProduct = gvSettingsProduct.FooterRow.FindControl("lnkbtnAddMoreProduct") as LinkButton; LinkButton lnkbtnAddSettingProduct = gvSettingsProduct.FooterRow.FindControl("lnkbtnAddSettingProduct") as LinkButton; LinkButton lnkbtnCancelSettingProduct = gvSettingsProduct.FooterRow.FindControl("lnkbtnCancelSettingProduct") as LinkButton; lnkbtnAddMoreProduct.Visible = false; lnkbtnAddSettingProduct.Visible = true; lnkbtnCancelSettingProduct.Visible = true; DropDownList ddlStewardshipsfooterProduct = gvSettingsProduct.FooterRow.FindControl("ddlStewardshipsfooterProduct") as DropDownList; DropDownList ddlstakeholderTypeListfooterProduct = gvSettingsProduct.FooterRow.FindControl("ddlstakeholderTypeListfooterProduct") as DropDownList; //DropDownList ddlProductNameFooter = gvSettingsProduct.FooterRow.FindControl("ddlProductNameFooter") as DropDownList; DropDownList ddlTireSizeListfooterProduct = gvSettingsProduct.FooterRow.FindControl("ddlTireSizeListfooterProduct") as DropDownList; DropDownList ddlProductShapeFooter = gvSettingsProduct.FooterRow.FindControl("ddlProductShapeFooter") as DropDownList; DropDownList ddlProductMaterialFooter = gvSettingsProduct.FooterRow.FindControl("ddlProductMaterialFooter") as DropDownList; TextBox txteffectivedatefooterProduct = gvSettingsProduct.FooterRow.FindControl("txteffectivedatefooterProduct") as TextBox; TextBox txtexpirationdatefooterProduct = gvSettingsProduct.FooterRow.FindControl("txtexpirationdatefooterProduct") as TextBox; TextBox txtDollarValuefooterProduct = gvSettingsProduct.FooterRow.FindControl("txtDollarValuefooterProduct") as TextBox; DropDownList ddlProductSubNameFooter = gvSettingsProduct.FooterRow.FindControl("ddlProductSubNameFooter") as DropDownList; ddlstakeholderTypeListfooterProduct.Visible = true; //ddlProductNameFooter.Visible = true; //ddlProductNameFooter.SelectedValue = CatId.ToString(); //ddlProductNameFooter.Enabled = false; ddlStewardshipsfooterProduct.Visible = true; ddlTireSizeListfooterProduct.Visible = true; ddlProductShapeFooter.Visible = true; ddlProductMaterialFooter.Visible = true; txteffectivedatefooterProduct.Visible = true; txtexpirationdatefooterProduct.Visible = true; txtDollarValuefooterProduct.Visible = true; lblErrorMessage.Visible = false; DataSet Check = null; Check = Product.GetAllSubCategories(Convert.ToInt32(ddlOrganizationProducts.SelectedValue)); if (Check != null && Check.Tables[0].Rows.Count > 0) { ddlProductSubNameFooter.Visible = true; } ScriptManager.RegisterStartupScript(this, GetType(), "AddDataPickerFooter", "SetDatePicket();", true); } else if (e.CommandName == "CancelSetting") { lblErrorMessage.Visible = false; gvSettingsProduct.EditIndex = -1; loadGridFroProduct(); } else if (e.CommandName == "Insert") { DropDownList ddlStewardshipsfooterProduct = gvSettingsProduct.FooterRow.FindControl("ddlStewardshipsfooterProduct") as DropDownList; DropDownList ddlstakeholderTypeListfooterProduct = gvSettingsProduct.FooterRow.FindControl("ddlstakeholderTypeListfooterProduct") as DropDownList; //DropDownList ddlProductNameFooter = gvSettingsProduct.FooterRow.FindControl("ddlProductNameFooter") as DropDownList; DropDownList ddlTireSizeListfooterProduct = gvSettingsProduct.FooterRow.FindControl("ddlTireSizeListfooterProduct") as DropDownList; DropDownList ddlProductShapeFooter = gvSettingsProduct.FooterRow.FindControl("ddlProductShapeFooter") as DropDownList; DropDownList ddlProductMaterialFooter = gvSettingsProduct.FooterRow.FindControl("ddlProductMaterialFooter") as DropDownList; TextBox txteffectivedatefooterProduct = gvSettingsProduct.FooterRow.FindControl("txteffectivedatefooterProduct") as TextBox; TextBox txtexpirationdatefooterProduct = gvSettingsProduct.FooterRow.FindControl("txtexpirationdatefooterProduct") as TextBox; TextBox txtDollarValuefooterProduct = gvSettingsProduct.FooterRow.FindControl("txtDollarValuefooterProduct") as TextBox; DropDownList ddlProductSubNameFooter = null; DataSet Check = null; Check = Product.GetAllSubCategories(Convert.ToInt32(ddlOrganizationProducts.SelectedValue)); if (Check != null && Check.Tables[0].Rows.Count > 0) { ddlProductSubNameFooter = gvSettingsProduct.FooterRow.FindControl("ddlProductSubNameFooter") as DropDownList; } if (Convert.ToDateTime(txtexpirationdatefooterProduct.Text) < Convert.ToDateTime(txteffectivedatefooterProduct.Text)) { lblErrorMessage.Text = "Expiry date must be greater than effective date"; lblErrorMessage.CssClass = "alert-danger custom-absolute-alert"; lblErrorMessage.Visible = true; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); return; } if (Convert.ToInt16(txtDollarValuefooterProduct.Text) <= 0) { lblErrorMessage.Text = "The amount entered should be greater than 0"; lblErrorMessage.Visible = true; return; } PTE objPTE = new PTE(); //objPTE.OrganizationId = UserOrganizationId; objPTE.StateId = Convert.ToInt32(ddlStewardshipsfooterProduct.SelectedValue); objPTE.OrganizationSubTypeId = Convert.ToInt32(ddlstakeholderTypeListfooterProduct.SelectedValue); //objPTE.ProductCategoryId = Convert.ToInt32(ddlProductNameFooter.SelectedValue); objPTE.ProductCategoryId = Convert.ToInt32(ddlOrganizationProducts.SelectedValue); if (Check != null && Check.Tables[0].Rows.Count > 0) objPTE.ProductSubCategoryId = Convert.ToInt32(ddlProductSubTypes.SelectedValue); else objPTE.ProductSubCategoryId = 0; objPTE.SizeId = Convert.ToInt32(ddlTireSizeListfooterProduct.SelectedValue); objPTE.ShapeId = Convert.ToInt32(ddlProductShapeFooter.SelectedValue); objPTE.MaterialId = Convert.ToInt32(ddlProductMaterialFooter.SelectedValue); objPTE.EffectiveDate = Convert.ToDateTime(txteffectivedatefooterProduct.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.ExpirationDate = Convert.ToDateTime(txtexpirationdatefooterProduct.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.DollarValue = float.Parse(txtDollarValuefooterProduct.Text); objPTE.LanguageId = LanguageId; objPTE.CreatedDate = DateTime.Now; objPTE.CreatedByUserId = UserInfo.GetCurrentUserInfo().UserId; int checkBit = 0; if (Convert.ToInt32(ddlOrganizationProducts.SelectedValue) == (int)ProductCategory.Tire) { checkBit = PTE.AddSetting(objPTE); } else { checkBit = PTE.AddSettingProduct(objPTE); } if (checkBit == 0) { lblErrorMessage.Visible = true; lblErrorMessage.Text = "Record already Exists..."; lblErrorMessage.CssClass = "alert-danger custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); return; } lblErrorMessage.Text = "Record added successfully..."; lblErrorMessage.Visible = true; lblErrorMessage.CssClass = "alert-success custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); loadGridFroProduct(); } }
protected void lnkAddSettingProduct_Click(object sender, EventArgs e) { if (Convert.ToDateTime(txtExpiryDateProduct.Text.Trim()) < Convert.ToDateTime(txtEffectiveDateProduct.Text.Trim())) { lblErrorMessage.Text = "Expiry date must be greater than effective date"; lblErrorMessage.CssClass = "alert-danger custom-absolute-alert"; lblErrorMessage.Visible = true; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); return; } PTE objPTE = new PTE(); //objPTE.OrganizationId = UserOrganizationId; objPTE.StateId = 0; objPTE.OrganizationSubTypeId = Convert.ToInt32(ddlStakeholderTypeProduct.SelectedValue); //objPTE.ProductCategoryId = Convert.ToInt32(ddlProductName.SelectedValue); objPTE.ProductCategoryId = Convert.ToInt32(ddlOrganizationProducts.SelectedValue); if (dvSubType.Visible) objPTE.ProductSubCategoryId = Convert.ToInt32(ddlProductSubTypes.SelectedValue); else objPTE.ProductSubCategoryId = 0; objPTE.SizeId = Convert.ToInt32(ddlProductSize.SelectedValue); objPTE.ShapeId = Convert.ToInt32(ddlProductShape.SelectedValue); objPTE.MaterialId = Convert.ToInt32(ddlProductMaterial.SelectedValue); objPTE.EffectiveDate = Convert.ToDateTime(txtEffectiveDateProduct.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.ExpirationDate = Convert.ToDateTime(txtExpiryDateProduct.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.DollarValue = float.Parse(txtDollarProduct.Text); objPTE.LanguageId = LanguageId; objPTE.CreatedDate = DateTime.Now; objPTE.CreatedByUserId = UserInfo.GetCurrentUserInfo().UserId; if (Convert.ToInt32(ddlOrganizationProducts.SelectedValue) == (int)ProductCategory.Tire) { PTE.AddSetting(objPTE); } else { PTE.AddSettingProduct(objPTE); } loadGridFroProduct(); }
protected void lnkbtnAddSetting_Click(object sender, EventArgs e) { PTE objPTE = new PTE(); objPTE.StateId = Convert.ToInt32(ddlStewardshipsfooter.SelectedItem.Value); objPTE.OrganizationSubTypeId = Convert.ToInt32(ddlstakeholderTypeListfooter.SelectedItem.Value); objPTE.SizeId = Convert.ToInt32(ddlTireSizeListfooter.SelectedValue); objPTE.EffectiveDate = Convert.ToDateTime(txteffectivedatefooter.Text, CultureInfo.InvariantCulture); objPTE.ExpirationDate = Convert.ToDateTime(txtexpirationdatefooter.Text, CultureInfo.InvariantCulture); objPTE.DollarValue = float.Parse(txtDollarValuefooter.Text); objPTE.LanguageId = LanguageId; objPTE.CreatedDate = DateTime.Now; objPTE.CreatedByUserId = UserInfo.GetCurrentUserInfo().UserId; PTE.AddSetting(objPTE); LoadAllSetting(); }
protected void gvSetting_RowUpdating(object sender, GridViewUpdateEventArgs e) { DropDownList ddlStewardships = gvSetting.Rows[e.RowIndex].FindControl("ddlStewardships") as DropDownList; DropDownList ddlsatkeholdertypeeditor = (DropDownList)gvSetting.Rows[e.RowIndex].FindControl("ddlstakeholderTypeListeditor"); DropDownList ddltiresizeeditor = (DropDownList)gvSetting.Rows[e.RowIndex].FindControl("ddlTireSizeListeditor"); TextBox txteffectdate = (TextBox)gvSetting.Rows[e.RowIndex].FindControl("txteffectivedateeditor"); TextBox txtexpireddate = (TextBox)gvSetting.Rows[e.RowIndex].FindControl("txtexpirationdateeditor"); TextBox txtdollarvalue = (TextBox)gvSetting.Rows[e.RowIndex].FindControl("txtDollarValueeditor"); if (Conversion.ParseDateTime(txtexpireddate.Text) < Conversion.ParseDateTime(txteffectdate.Text) ) { lblErrorMessage.Text = "Expiry date must be greater than effective date"; lblErrorMessage.Visible = true; return; } else { lblErrorMessage.Text = ""; lblErrorMessage.Visible = false; } PTE objPTE = new PTE(); objPTE.PteId = Convert.ToInt32(gvSetting.DataKeys[e.RowIndex].Values[0].ToString()); objPTE.StateId = Convert.ToInt32(ddlStewardships.SelectedItem.Value); objPTE.OrganizationSubTypeId = Convert.ToInt32(ddlsatkeholdertypeeditor.SelectedValue); objPTE.SizeId = Convert.ToInt32(ddltiresizeeditor.SelectedValue); objPTE.EffectiveDate = Convert.ToDateTime(txteffectdate.Text, CultureInfo.InvariantCulture); objPTE.ExpirationDate = Convert.ToDateTime(txtexpireddate.Text, CultureInfo.InvariantCulture); objPTE.DollarValue = float.Parse(txtdollarvalue.Text); objPTE.UpdatedDate = DateTime.Now; objPTE.UpdatedByUserId = UserInfo.GetCurrentUserInfo().UserId; PTE.UpdateSetting(objPTE); gvSetting.EditIndex = -1; loadGridAndHeaderText(); }
protected void gvSetting_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit") { pteId = Convert.ToInt32(e.CommandArgument); lblErrorMessage.Visible = false; } else if (e.CommandName == "Delete") { lblErrorMessage.Visible = false; PTE.DeleteSetting(Convert.ToInt32(e.CommandArgument), DateTime.Now, UserInfo.GetCurrentUserInfo().UserId); loadGridAndHeaderText(); } else if (e.CommandName == "AddMore") { // LinkButton lnkbtnAddMore = gvSetting.FooterRow.FindControl("lnkbtnAddMore") as LinkButton; LinkButton lnkbtnAddMoreSetting = gvSetting.FooterRow.FindControl("lnkbtnAddMore") as LinkButton; LinkButton lnkbtnAddSetting = gvSetting.FooterRow.FindControl("lnkbtnAddSetting") as LinkButton; LinkButton lnkbtnCancelSetting = gvSetting.FooterRow.FindControl("lnkbtnCancelSetting") as LinkButton; lnkbtnAddSetting.Visible = true; lnkbtnAddMoreSetting.Visible = false; lnkbtnCancelSetting.Visible = true; DropDownList ddlStewardshipsfooter = gvSetting.FooterRow.FindControl("ddlStewardshipsfooter") as DropDownList; DropDownList dllstakeholdertypefooter = gvSetting.FooterRow.FindControl("ddlstakeholderTypeListfooter") as DropDownList; DropDownList dlltiresizefooter = gvSetting.FooterRow.FindControl("ddlTireSizeListfooter") as DropDownList; TextBox txtEffectiveDate = gvSetting.FooterRow.FindControl("txteffectivedatefooter") as TextBox; TextBox txtExpirtaionDate = gvSetting.FooterRow.FindControl("txtexpirationdatefooter") as TextBox; TextBox txtDollarValue = gvSetting.FooterRow.FindControl("txtDollarValuefooter") as TextBox; ddlStewardshipsfooter.Visible = true; dllstakeholdertypefooter.Visible = true; dlltiresizefooter.Visible = true; txtEffectiveDate.Visible = true; txtExpirtaionDate.Visible = true; txtDollarValue.Visible = true; lblErrorMessage.Visible = false; ScriptManager.RegisterStartupScript(this, GetType(), "AddDataPickerFooter", "SetDatePicket();", true); } else if (e.CommandName == "CancelSetting") { lblErrorMessage.Visible = false; gvSetting.EditIndex = -1; loadGridAndHeaderText(); } else if (e.CommandName == "Insert") { DropDownList ddlStewardshipsfooter = gvSetting.FooterRow.FindControl("ddlStewardshipsfooter") as DropDownList; DropDownList dllstakeholdertypefooter = gvSetting.FooterRow.FindControl("ddlstakeholderTypeListfooter") as DropDownList; DropDownList dlltiresizefooter = gvSetting.FooterRow.FindControl("ddlTireSizeListfooter") as DropDownList; TextBox txtEffectiveDate = gvSetting.FooterRow.FindControl("txteffectivedatefooter") as TextBox; TextBox txtExpirtaionDate = gvSetting.FooterRow.FindControl("txtexpirationdatefooter") as TextBox; TextBox txtDollarValue = gvSetting.FooterRow.FindControl("txtDollarValuefooter") as TextBox; if (Conversion.ParseDateTime(txtEffectiveDate.Text) > Conversion.ParseDateTime(txtExpirtaionDate.Text)) { lblErrorMessage.Text = "Expiry date must be greater than effective date"; lblErrorMessage.Visible = true; lblErrorMessage.ForeColor = System.Drawing.Color.Red; return; } else { lblErrorMessage.Text = ""; lblErrorMessage.Visible = false; } PTE objPTE = new PTE(); objPTE.StateId = Convert.ToInt32(ddlStewardshipsfooter.SelectedItem.Value); objPTE.OrganizationSubTypeId = Convert.ToInt32(dllstakeholdertypefooter.SelectedItem.Value); objPTE.SizeId = Convert.ToInt32(dlltiresizefooter.SelectedValue); objPTE.EffectiveDate = Convert.ToDateTime(txtEffectiveDate.Text, CultureInfo.InvariantCulture); objPTE.ExpirationDate = Convert.ToDateTime(txtExpirtaionDate.Text, CultureInfo.InvariantCulture); objPTE.DollarValue = float.Parse(txtDollarValue.Text); objPTE.LanguageId = LanguageId; objPTE.CreatedDate = DateTime.Now; objPTE.CreatedByUserId = UserInfo.GetCurrentUserInfo().UserId; // objPTE.OrganizationId = UserOrganizationId; int checkBit = PTE.AddSetting(objPTE); if (checkBit == 0) { lblErrorMessage.Visible = true; lblErrorMessage.Text = "Record Already Exists..."; } loadGridAndHeaderText(); } }
protected void gvSettingsProduct_RowUpdating(object sender, GridViewUpdateEventArgs e) { DropDownList ddlStewardshipsProduct = gvSettingsProduct.Rows[e.RowIndex].FindControl("ddlStewardshipsProduct") as DropDownList; DropDownList ddlstakeholderTypeListeditorProduct = gvSettingsProduct.Rows[e.RowIndex].FindControl("ddlstakeholderTypeListeditorProduct") as DropDownList; //DropDownList ddlProductNamegv = gvSettingsProduct.Rows[e.RowIndex].FindControl("ddlProductNamegv") as DropDownList; DropDownList ddlTireSizeListeditorProduct = gvSettingsProduct.Rows[e.RowIndex].FindControl("ddlTireSizeListeditorProduct") as DropDownList; DropDownList ddlProductShape = gvSettingsProduct.Rows[e.RowIndex].FindControl("ddlProductShape") as DropDownList; DropDownList ddlProductMaterial = gvSettingsProduct.Rows[e.RowIndex].FindControl("ddlProductMaterial") as DropDownList; TextBox txteffectivedateeditorProduct = gvSettingsProduct.Rows[e.RowIndex].FindControl("txteffectivedateeditorProduct") as TextBox; TextBox txtexpirationdateeditorProduct = gvSettingsProduct.Rows[e.RowIndex].FindControl("txtexpirationdateeditorProduct") as TextBox; TextBox txtDollarValueeditorProduct = gvSettingsProduct.Rows[e.RowIndex].FindControl("txtDollarValueeditorProduct") as TextBox; DropDownList ddlProductSubNamegv = null; DataSet Check = null; Check = Product.GetAllSubCategories(Convert.ToInt32(ddlOrganizationProducts.SelectedValue)); if (Check != null && Check.Tables[0].Rows.Count > 0) { ddlProductSubNamegv = gvSettingsProduct.Rows[e.RowIndex].FindControl("ddlProductSubNamegv") as DropDownList; } if (Convert.ToDateTime(txtexpirationdateeditorProduct.Text) < Convert.ToDateTime(txteffectivedateeditorProduct.Text)) { lblErrorMessage.Text = "Expiry date must be greater than effective date"; lblErrorMessage.CssClass = "alert-danger custom-absolute-alert"; lblErrorMessage.Visible = true; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); return; } if (Convert.ToInt16(txtDollarValueeditorProduct.Text) <= 0) { lblErrorMessage.Text = "The amount entered should be greater than 0"; lblErrorMessage.Visible = true; return; } PTE objPTE = new PTE(); //objPTE.OrganizationId = UserOrganizationId; objPTE.StateId = Convert.ToInt32(ddlStewardshipsProduct.SelectedValue); objPTE.OrganizationSubTypeId = Convert.ToInt32(ddlstakeholderTypeListeditorProduct.SelectedValue); //objPTE.ProductCategoryId = Convert.ToInt32(ddlProductNamegv.SelectedValue); objPTE.ProductCategoryId = Convert.ToInt32(ddlOrganizationProducts.SelectedValue); if (Check != null && Check.Tables[0].Rows.Count > 0) objPTE.ProductSubCategoryId = Convert.ToInt32(ddlProductSubTypes.SelectedValue); else objPTE.ProductSubCategoryId = 0; objPTE.PteId = Convert.ToInt32(hdnPTEId.Value); objPTE.SizeId = Convert.ToInt32(ddlTireSizeListeditorProduct.SelectedValue); objPTE.ShapeId = Convert.ToInt32(ddlProductShape.SelectedValue); objPTE.MaterialId = Convert.ToInt32(ddlProductMaterial.SelectedValue); objPTE.EffectiveDate = Convert.ToDateTime(txteffectivedateeditorProduct.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.ExpirationDate = Convert.ToDateTime(txtexpirationdateeditorProduct.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.DollarValue = float.Parse(txtDollarValueeditorProduct.Text); objPTE.LanguageId = LanguageId; objPTE.CreatedDate = DateTime.Now; objPTE.CreatedByUserId = UserInfo.GetCurrentUserInfo().UserId; int checkBit = 0; if (Convert.ToInt32(ddlOrganizationProducts.SelectedValue) == (int)ProductCategory.Tire) { checkBit = PTE.AddSetting(objPTE); } else { checkBit = PTE.AddSettingProduct(objPTE); } if (checkBit == 0) { lblErrorMessage.Visible = true; lblErrorMessage.Text = "Record already Exists..."; lblErrorMessage.CssClass = "alert-danger custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); return; } lblErrorMessage.Text = "Record added successfully..."; lblErrorMessage.Visible = true; lblErrorMessage.CssClass = "alert-success custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); gvSettingsProduct.EditIndex = -1; loadGridFroProduct(); }
protected void lnkbtnAddSetting_Click(object sender, EventArgs e) { PTE objPTE = new PTE(); //objPTE.OrganizationId = UserOrganizationId; objPTE.StateId = stateID; objPTE.OrganizationSubTypeId = Convert.ToInt32(ddlstakeholderTypeListfooter.SelectedValue); objPTE.SizeId = Convert.ToInt32(ddlTireSizeListfooter.SelectedValue); objPTE.EffectiveDate = Convert.ToDateTime(txteffectivedatefooter.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.ExpirationDate = Convert.ToDateTime(txtexpirationdatefooter.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.DollarValue = float.Parse(txtDollarValuefooter.Text); objPTE.LanguageId = LanguageId; objPTE.CreatedDate = DateTime.Now; objPTE.CreatedByUserId = UserInfo.GetCurrentUserInfo().UserId; if (Convert.ToInt32(ddlOrganizationProducts.SelectedValue) == (int)ProductCategory.Tire) { PTE.AddSetting(objPTE); } else { PTE.AddSettingProduct(objPTE); } loadGridAndHeaderText(); }
protected void gvSetting_RowUpdating(object sender, GridViewUpdateEventArgs e) { DropDownList ddlsatkeholdertypeeditor = (DropDownList)gvSetting.Rows[e.RowIndex].FindControl("ddlstakeholderTypeListeditor"); DropDownList ddltiresizeeditor = (DropDownList)gvSetting.Rows[e.RowIndex].FindControl("ddlTireSizeListeditor"); TextBox txteffectdate = (TextBox)gvSetting.Rows[e.RowIndex].FindControl("txteffectivedateeditor"); TextBox txtexpireddate = (TextBox)gvSetting.Rows[e.RowIndex].FindControl("txtexpirationdateeditor"); TextBox txtdollarvalue = (TextBox)gvSetting.Rows[e.RowIndex].FindControl("txtDollarValueeditor"); string effectDate = txteffectdate.Text; string expiryDate = txtexpireddate.Text; if (Convert.ToDateTime(txtexpireddate.Text.Trim()) < Convert.ToDateTime(txteffectdate.Text.Trim())) { lblErrorMessage.Text = "Expiry date must be greater than effective date"; lblErrorMessage.CssClass = "alert-danger custom-absolute-alert"; lblErrorMessage.Visible = true; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); return; } lblErrorMessage.Visible = false; PTE objPTE = new PTE(); //objPTE.OrganizationId = UserOrganizationId; objPTE.PteId = Convert.ToInt32(hdnPTEId.Value); objPTE.StateId = stateID; objPTE.PteId = Convert.ToInt32(hdnPTEId.Value); //Convert.ToInt32(gvSetting.DataKeys[e.RowIndex].Values[0].ToString()); objPTE.OrganizationSubTypeId = Convert.ToInt32(ddlsatkeholdertypeeditor.SelectedValue); objPTE.SizeId = Convert.ToInt32(ddltiresizeeditor.SelectedValue); objPTE.EffectiveDate = Convert.ToDateTime(txteffectdate.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.ExpirationDate = Convert.ToDateTime(txtexpireddate.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.DollarValue = float.Parse(txtdollarvalue.Text); objPTE.UpdatedDate = DateTime.Now; objPTE.UpdatedByUserId = UserInfo.GetCurrentUserInfo().UserId; int chkBit = PTE.UpdateSetting(objPTE); if (chkBit == 0) { lblErrorMessage.Text = "Record Already Exists..."; lblErrorMessage.Visible = true; lblErrorMessage.CssClass = "alert-danger custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); return; } lblErrorMessage.Text = "Record updated successfully..."; lblErrorMessage.Visible = true; lblErrorMessage.CssClass = "alert-success custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); gvSetting.EditIndex = -1; loadGridAndHeaderText(); }
protected void gvSetting_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit") { //pteID = Convert.ToInt32(e.CommandArgument); hdnPTEId.Value = e.CommandArgument.ToString(); lblErrorMessage.Visible = false; } else if (e.CommandName == "Delete") { lblErrorMessage.Visible = false; PTE.DeleteSetting(Convert.ToInt32(e.CommandArgument), DateTime.Now, UserInfo.GetCurrentUserInfo().UserId); loadGridAndHeaderText(); } else if (e.CommandName == "AddMore") { // LinkButton lnkbtnAddMore = gvSetting.FooterRow.FindControl("lnkbtnAddMore") as LinkButton; LinkButton lnkbtnAddMoreSetting = gvSetting.FooterRow.FindControl("lnkbtnAddMore") as LinkButton; LinkButton lnkbtnAddSetting = gvSetting.FooterRow.FindControl("lnkbtnAddSetting") as LinkButton; LinkButton lnkbtnCancelSetting = gvSetting.FooterRow.FindControl("lnkbtnCancelSetting") as LinkButton; lnkbtnAddSetting.Visible = true; lnkbtnAddMoreSetting.Visible = false; lnkbtnCancelSetting.Visible = true; DropDownList dllstakeholdertypefooter = gvSetting.FooterRow.FindControl("ddlstakeholderTypeListfooter") as DropDownList; DropDownList dlltiresizefooter = gvSetting.FooterRow.FindControl("ddlTireSizeListfooter") as DropDownList; TextBox txtEffectiveDate = gvSetting.FooterRow.FindControl("txteffectivedatefooter") as TextBox; TextBox txtExpirtaionDate = gvSetting.FooterRow.FindControl("txtexpirationdatefooter") as TextBox; TextBox txtDollarValue = gvSetting.FooterRow.FindControl("txtDollarValuefooter") as TextBox; dllstakeholdertypefooter.Visible = true; dlltiresizefooter.Visible = true; txtEffectiveDate.Visible = true; txtExpirtaionDate.Visible = true; txtDollarValue.Visible = true; lblErrorMessage.Visible = false; ScriptManager.RegisterStartupScript(this, GetType(), "AddDataPickerFooter", "SetDatePicket();", true); } else if (e.CommandName == "CancelSetting") { lblErrorMessage.Visible = false; gvSetting.EditIndex = -1; loadGridAndHeaderText(); } else if (e.CommandName == "Insert") { DropDownList dllstakeholdertypefooter = gvSetting.FooterRow.FindControl("ddlstakeholderTypeListfooter") as DropDownList; DropDownList dlltiresizefooter = gvSetting.FooterRow.FindControl("ddlTireSizeListfooter") as DropDownList; TextBox txtEffectiveDate = gvSetting.FooterRow.FindControl("txteffectivedatefooter") as TextBox; TextBox txtExpirtaionDate = gvSetting.FooterRow.FindControl("txtexpirationdatefooter") as TextBox; TextBox txtDollarValue = gvSetting.FooterRow.FindControl("txtDollarValuefooter") as TextBox; if (Convert.ToDateTime(txtExpirtaionDate.Text) < Convert.ToDateTime(txtEffectiveDate.Text)) { lblErrorMessage.Text = "Expiry date must be greater than effective date"; lblErrorMessage.CssClass = "alert-danger custom-absolute-alert"; lblErrorMessage.Visible = true; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); return; } if (Convert.ToInt16(txtDollarValue.Text) <= 0) { lblErrorMessage.Text = "The amount entered should be greater than 0"; lblErrorMessage.Visible = true; return; } PTE objPTE = new PTE(); //objPTE.OrganizationId = UserOrganizationId; objPTE.StateId = stateID; objPTE.OrganizationSubTypeId = Convert.ToInt32(dllstakeholdertypefooter.SelectedValue); objPTE.SizeId = Convert.ToInt32(dlltiresizefooter.SelectedValue); objPTE.EffectiveDate = Convert.ToDateTime(txtEffectiveDate.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.ExpirationDate = Convert.ToDateTime(txtExpirtaionDate.Text, System.Globalization.CultureInfo.InvariantCulture); objPTE.DollarValue = float.Parse(txtDollarValue.Text); objPTE.LanguageId = LanguageId; objPTE.CreatedDate = DateTime.Now; objPTE.CreatedByUserId = UserInfo.GetCurrentUserInfo().UserId; int checkBit = 0; if (Convert.ToInt32(ddlOrganizationProducts.SelectedValue) == (int)ProductCategory.Tire) { checkBit = PTE.AddSetting(objPTE); } else { checkBit = PTE.AddSettingProduct(objPTE); } if (checkBit == 0) { lblErrorMessage.Visible = true; lblErrorMessage.Text = "Record already Exists..."; lblErrorMessage.CssClass = "alert-danger custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); return; } lblErrorMessage.Text = "Record added successfully..."; lblErrorMessage.Visible = true; lblErrorMessage.CssClass = "alert-success custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); loadGridAndHeaderText(); } }
public static int UpdateSetting(PTE objPTE) { int chkBit; List<SqlParameter> prm = new List<SqlParameter>(); try { using (DbManager DB = DbManager.GetDbManager()) { prm.Add(DB.MakeInParam("@PTEId", SqlDbType.Int, 4, objPTE.PteId)); prm.Add(DB.MakeInParam("@StateId", SqlDbType.Int, 4, objPTE.StateId)); prm.Add(DB.MakeInParam("@OrganizationSubTypeId", SqlDbType.Int, 4, objPTE.OrganizationSubTypeId)); prm.Add(DB.MakeInParam("@SizeId", SqlDbType.Int, 4, objPTE.SizeId)); prm.Add(DB.MakeInParam("@EffectiveDate", SqlDbType.DateTime, 8, objPTE.EffectiveDate)); prm.Add(DB.MakeInParam("@ExpirationDate", SqlDbType.DateTime, 8, objPTE.ExpirationDate)); prm.Add(DB.MakeInParam("@DollarValue", SqlDbType.Float, 8, objPTE.DollarValue)); prm.Add(DB.MakeInParam("@UpdatedDate", SqlDbType.DateTime, 8, objPTE.UpdatedDate)); prm.Add(DB.MakeInParam("@UpdatedByUserId", SqlDbType.Int, 4, objPTE.UpdatedByUserId)); prm.Add(DB.MakeOutParam("@bit", SqlDbType.Int, 4)); chkBit = DB.RunProc("up_PTE_Edit", prm.ToArray()); chkBit = Conversion.ParseInt(prm.Last<SqlParameter>().Value); } } catch (Exception ex) { chkBit = 0; new SqlLog().InsertSqlLog(0, "PTE.UpdateSetting", ex); } return chkBit; }
public static int AddSettingProduct(PTE objPTE) { int checkBit; List<SqlParameter> prm = new List<SqlParameter>(); try { using (DbManager DB = DbManager.GetDbManager()) { prm.Add(DB.MakeInParam("@PteId", SqlDbType.Int, 4, objPTE.PteId)); prm.Add(DB.MakeInParam("@StateId", SqlDbType.Int, 4, objPTE.StateId)); prm.Add(DB.MakeInParam("@OrganizationSubTypeId", SqlDbType.Int, 0, objPTE.OrganizationSubTypeId)); prm.Add(DB.MakeInParam("@SizeId", SqlDbType.Int, 0, objPTE.SizeId)); //if (objPTE.ShapeId != 0) prm.Add(DB.MakeInParam("@ShapeId", SqlDbType.Int, 0, objPTE.ShapeId)); //else // prm.Add(DB.MakeInParam("@ShapeId", SqlDbType.Int, 0, DBNull.Value)); //if (objPTE.MaterialId != 0) prm.Add(DB.MakeInParam("@MaterialId", SqlDbType.Int, 0, objPTE.MaterialId)); //else // prm.Add(DB.MakeInParam("@MaterialId", SqlDbType.Int, 0, DBNull.Value)); prm.Add(DB.MakeInParam("@EffectiveDate", SqlDbType.DateTime, 0, objPTE.EffectiveDate)); prm.Add(DB.MakeInParam("@ExpirationDate", SqlDbType.DateTime, 0, objPTE.ExpirationDate)); prm.Add(DB.MakeInParam("@DollarValue", SqlDbType.Float, 0, objPTE.DollarValue)); prm.Add(DB.MakeInParam("@LanguageId", SqlDbType.Int, 0, objPTE.LanguageId)); prm.Add(DB.MakeInParam("@CreatedDate", SqlDbType.DateTime, 0, objPTE.CreatedDate)); prm.Add(DB.MakeInParam("@CreatedByUserId", SqlDbType.Int, 0, objPTE.CreatedByUserId)); // prm.Add(DB.MakeReturnParam(SqlDbType.Int, 0)); prm.Add(DB.MakeInParam("@CatId", SqlDbType.Int, 0, objPTE.ProductCategoryId)); prm.Add(DB.MakeInParam("@SubCatId", SqlDbType.Int, 0, objPTE.ProductSubCategoryId)); prm.Add(DB.MakeOutParam("@bit", SqlDbType.Int, 4)); checkBit = DB.RunProc("up_PTE_add_Product", prm.ToArray()); checkBit = Conversion.ParseInt(prm.Last<SqlParameter>().Value); } } catch (Exception ex) { checkBit = 0; new SqlLog().InsertSqlLog(0, "PTE.AddSettingProduct", ex); } return checkBit; }