protected void btnSubmit_Click(object sender, EventArgs e) { decimal mat_id = WebTools.GetMatId(txtAutoCompltMatList.Entries[0].Text, Decimal.Parse(Session["PROJECT_ID"].ToString())); if (mat_id == -1) { Master.show_error("There are two materials with the same code! try to use the unique one."); return; } else if (mat_id == 0) { Master.show_error("Material Code not found!"); return; } VIEW_MATERIAL_REQUEST_DTTableAdapter items = new VIEW_MATERIAL_REQUEST_DTTableAdapter(); try { items.InsertQuery(decimal.Parse(Request.QueryString["MAT_REQ_ID"]), mat_id, decimal.Parse(txtReqQty.Text), DateTime.Parse(txtReqDate.SelectedDate.ToString()), txtRqrdAtLocation.Text, txtRemarks.Text); Master.show_success(txtAutoCompltMatList.Entries[0].Text + " Saved!"); } catch (Exception ex) { Master.show_error(ex.Message); } finally { items.Dispose(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { decimal mat_id = WebTools.GetMatId(ddlMatCode.Text, Decimal.Parse(Session["PROJECT_ID"].ToString())); if (mat_id == -1) { //Master.ShowWarn("There are two materials with the same code! try to use the unique one."); RadWindowManager1.RadAlert("There are two materials with the same code! try to use the unique one.", 400, 150, "Warning", ""); return; } else if (mat_id == 0) { // Master.ShowWarn("Material Code not found!"); RadWindowManager1.RadAlert("Material Code not found!", 400, 150, "Warning", ""); return; } VIEW_MATERIAL_REQUEST_DTTableAdapter items = new VIEW_MATERIAL_REQUEST_DTTableAdapter(); try { items.InsertQuery(decimal.Parse(Request.QueryString["MAT_REQ_ID"]), decimal.Parse(txtMrItem.Text), mat_id, ddlHeatNo.SelectedValue, txtCabledrum.SelectedValue, decimal.Parse(txtReqQty.Text), txtReqDate.SelectedDate, txtRqrdAtLocation.Text, null, null, txtRemarks.Text, decimal.Parse(ddlPO.SelectedValue)); RadGrid1.DataBind(); //Master.ShowMessage(txtMatCode.Text + " Saved!"); RadWindowManager1.RadAlert("Material Added.", 400, 150, "Success", ""); decimal mr_item_no = WebTools.DMax("MR_ITEM_NO", "MATERIAL_REQUEST_DETAIL", " WHERE MAT_REQ_ID='" + Request.QueryString["MAT_REQ_ID"] + "'"); txtMrItem.Text = (mr_item_no + 1).ToString(); } catch (Exception ex) { //Master.ShowWarn(ex.Message); RadWindowManager1.RadAlert("Access denied.", 400, 150, "Warning", ""); } finally { items.Dispose(); } }