protected void ddlSystemParams_SelectedIndexChanged(object sender, EventArgs e) { Int32 paramid = 0; string paramid_str = ddlSystemParams.SelectedItem.Value; try { if (paramid_str != string.Empty) { paramid = Int32.Parse(paramid_str); } SystemParamsDAO sydao = new SystemParamsDAO(); string paramtyp = sydao.Get_param_type(paramid); txtParmType.Text = paramtyp; string paramval = sydao.Get_param_value(paramid); txtParamValue.Text = paramval; } catch (Exception ex) { HandleError(ex.Message, 1); } }
protected void btnSave_Click(object sender, EventArgs e) { //validation Int32 paramid = 0; string paramid_str = ddlSystemParams.SelectedItem.Value; string displayname = User.Identity.Name; SystemParamsDAO sydao = new SystemParamsDAO(); try { if (paramid_str != string.Empty) { paramid = Int32.Parse(paramid_str); } string paramtyp = sydao.Get_param_type_code(paramid); string paramval = txtParamValue.Text; if (paramtyp == "I") { Int32 paramvalint = Int32.Parse(paramval); } else if (paramtyp == "N") { decimal paramvaldec = decimal.Parse(paramval); } else if (paramtyp == "C") { } else if (paramtyp == "D") { DateTime paramvaldt = DateTime.Parse(paramval); } // update database for param value decimal paramidop = sydao.Update_params(paramid, paramtyp, paramval, displayname); if (paramidop == 0) { HandleError("Invalid Parameter Type", 1); } else { HandleError("Parameter Value updated successfully", 0); } } catch (Exception ex1) { HandleError(ex1.Message, 1); } }
private void Getdropdown() { SystemParamsDAO sydao = new SystemParamsDAO(); DataSet ds_sp = new DataSet(); DataTable dt_sp = new DataTable(); ds_sp = sydao.Get_pararms(); dt_sp = ds_sp.Tables[0]; foreach (DataRow row in dt_sp.Rows) { string sp_code_str = row["param_id"].ToString(); string sp_desc = row["param_name"].ToString(); ddlSystemParams.Items.Insert(0, new ListItem(sp_desc, sp_code_str)); } }
protected void CagesRadGrid_InsertCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { int numOfCages = (int)((RadNumericTextBox)(e.Item.FindControl("numcages_radnumerictextbox"))).Value; string cageType = ((RadComboBox)e.Item.FindControl("cagetype_radcombobox")).SelectedValue; string createForStores = ((RadioButtonList)e.Item.FindControl("rblCreateForStores")).SelectedValue; bool storesFound = false; if (createForStores == "T") { CageDAO cagedao = new CageDAO(); PrintService ps = new PrintService(); SystemParamsDAO sysParam = new SystemParamsDAO(); const Int32 toteDelayParamId = 24; const int labelsInBatch = 50; const int defaultDelay = 50; int delayCounter = 0; int delaySeconds; try { if (!int.TryParse(sysParam.Get_param_value(toteDelayParamId), out delaySeconds)) { delaySeconds = defaultDelay; // if param not set then use default delay. } } catch // The params package doesn't handle parameter not found so need to catch error. { delaySeconds = defaultDelay; // if param not set then use default delay. } // Creating IDataReader in a using block should tidy up properly when we are finished with it or // in case of failure. using (IDataReader toteLabels = cagedao.GetToteLabels(numOfCages, cageType, User.Identity.Name)) { while (toteLabels.Read()) { storesFound = true; ps.PrintPackDocuments(Convert.ToDecimal(toteLabels["order_id"].ToString()), true, Shared.UserHostName, "L", Shared.CurrentUser); delayCounter++; if (delayCounter == labelsInBatch) { System.Threading.Thread.Sleep(delaySeconds * 1000); // Sleep is in milliseconds delayCounter = 0; } } } if (storesFound) { DisplayMessage(false, "Tote Label(s) of type " + cageType + " created"); } else { DisplayMessage(true, "Error: No valid stores for tote labels found for cage type " + cageType); } } else { DoCageCreate(cageType, numOfCages); DisplayMessage(false, numOfCages.ToString() + " cage(s) of type " + cageType + " created"); } }