/* * Update the size. */ protected void UpdateSize_Click(object sender, EventArgs e) { try { if (txtSizeCode.Text.Trim() == string.Empty) { ModlPopup.Show(); lblErrMessageUpdate.Text = "Please enter the size code."; return; } if (txtSizeName.Text.Trim() == string.Empty) { ModlPopup.Show(); lblErrMessageUpdate.Text = "Please enter the size name."; return; } int id = Convert.ToInt32(HiddenField.Value); string sizeCode = txtSizeCode.Text.Trim(); string lblSizeName = txtSizeName.Text.Trim(); if (txtSizeCode.Text != string.Empty && txtSizeName.Text != string.Empty) { int updateSize = (new CatalogSizesDAL()).UpdateSize_DAL(id, sizeCode, lblSizeName); FillGridView(); } } catch (Exception ex) { string strErrCode = ERROR_DISPLAY_MESSAGE + "," + (new Error_Log()).LogErrorIntoDB(ex, "UpdateSize_Click"); lblErr.Text = strErrCode; } }
/* * Change the color of the row when mouse over. */ //protected void GridView_OnRowCreated(object sender, GridViewRowEventArgs e) //{ // if (e.Row.RowType == DataControlRowType.DataRow) // { // e.Row.Attributes.Add("onmouseover", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#FFFFCC'"); // e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.originalstyle;"); // //e.Row.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference((Control)sender, "Select$" + e.Row.RowIndex.ToString())); // } //} /* * Click on Size ID to popup edit window. */ protected void GridView_OnRowCommand(object sender, GridViewCommandEventArgs e) { try { lblErrProduct.Text = string.Empty; lblErrMessageUpdate.Text = string.Empty; if (e.CommandName == "Popup") { int id = Convert.ToInt32(e.CommandArgument); //Size_ID try { //Get data from database and populate it on the popup window. DataSet editSize = (new CatalogSizesDAL()).GetSizeBySizeID_DAL(id); HiddenField.Value = editSize.Tables[0].Rows[0]["Size_ID"].ToString(); txtSizeCode.Text = editSize.Tables[0].Rows[0]["Size_Code"].ToString(); txtSizeName.Text = editSize.Tables[0].Rows[0]["Size_Name"].ToString(); ModlPopup.Show(); } catch (Exception ex) { lblErrProduct.Text = ex.Message; } } else if (e.CommandName == "ToggleSize") { lblErrProduct.Text = string.Empty; hfCurrentSizeID.Value = e.CommandArgument.ToString(); CatalogSizesDAL sizeDAL = new CatalogSizesDAL(); if (((LinkButton)e.CommandSource).Text == "Inactive") { sizeDAL.DeleteSize_DAL(int.Parse(e.CommandArgument.ToString()), true); } else { sizeDAL.DeleteSize_DAL(int.Parse(e.CommandArgument.ToString()), false); string deleteSize = (new CatalogSizesDAL()).DeleteSize_DAL(int.Parse(e.CommandArgument.ToString()), false); if (deleteSize != string.Empty) { lblErrProduct.Visible = true; lblErrProduct.Text = "Unable to Inactive the size as it is currently in use by the product."; FillGridView(); } } FillGridView(); } } catch (Exception ex) { string strErrCode = ERROR_DISPLAY_MESSAGE + "," + (new Error_Log()).LogErrorIntoDB(ex, "GridView_OnRowCommand"); lblErr.Text = strErrCode; } }//End of GridView_OnRowCommand...
protected void Cancel_Click(object sender, EventArgs e) { try { ModlPopup.Hide(); lblErrMessageUpdate.Text = string.Empty; } catch (Exception ex) { string strErrCode = ERROR_DISPLAY_MESSAGE + "," + (new Error_Log()).LogErrorIntoDB(ex, "Cancel_Click"); lblErr.Text = strErrCode; } }