public bool InsertOffsetDataLow(OffsetMasterInfo mstInfo) { try { int partID = Convert.ToInt16(mstInfo.Part_id); if (partID != 6) { offTba.InsertOffsetData(mstInfo.Model_id, (partID + 5).ToString(), mstInfo.PartType_id, mstInfo.Offset_id, mstInfo.Offset_point, (mstInfo.Offset_value / 1000), DateTime.Now, mstInfo.Offset_user); } else { offTba.InsertOffsetData(mstInfo.Model_id, (partID + 3).ToString(), mstInfo.PartType_id, mstInfo.Offset_id, mstInfo.Offset_point, (mstInfo.Offset_value / 1000), DateTime.Now, mstInfo.Offset_user); } return(true); } catch { return(false); } }
public bool InsertOffsetData(OffsetMasterInfo mstInfo) { try { offTba.InsertOffsetData(mstInfo.Model_id, mstInfo.Part_id, mstInfo.PartType_id, mstInfo.Offset_id, mstInfo.Offset_point, (mstInfo.Offset_value / 1000), DateTime.Now, mstInfo.Offset_user); return(true); } catch { return(false); } }
public bool UpdateOffsetData(OffsetMasterInfo mstInfo, int _point) { try { offTba.UpdateOffsetData( (mstInfo.Offset_value / 1000), DateTime.Now, mstInfo.Offset_user, mstInfo.Model_id, mstInfo.Part_id, mstInfo.PartType_id, mstInfo.Offset_id, _point); return(true); } catch { return(false); } }
private object DataRowToObject(DataRow r, Type t) { if (t == typeof(OffsetMasterInfo)) { OffsetMasterInfo item = new OffsetMasterInfo(); DataSet.etd_offset_detailRow dr = (DataSet.etd_offset_detailRow)r; item.Model_id = dr.m_id; item.Part_id = dr.p_id; item.PartType_id = dr.pt_id; item.Offset_id = dr.of_id; item.Offset_point = dr.of_point; item.Offset_value = (dr.of_val * 1000); item.Offset_user = dr.of_user; return(item); } return(null); }
protected void btnSave_Click(object sender, EventArgs e) { if (txtMasterNo.Text != "" && txtID1.Text != "" && txtID2.Text != "" && txtP1.Text != "") { //insert data to database OffsetMasterInfo offInfo = new OffsetMasterInfo(); offInfo.Model_id = DropDownListModelName.SelectedValue.ToString(); offInfo.Offset_id = txtMasterNo.Text; offInfo.Part_id = _partID; offInfo.PartType_id = _partTypeID; offInfo.Offset_user = Session["userName"].ToString(); if (Convert.ToBoolean(Session["editState"]) == false) { for (int i = 0; i < 3; i++) { offInfo.Offset_point = i; if (i == 0) { offInfo.Offset_value = Convert.ToDouble(txtID1.Text); if (offSer.InsertOffsetData(offInfo)) { offSer.InsertOffsetDataLow(offInfo); txtID1.Text = ""; } } else if (i == 1) { offInfo.Offset_value = Convert.ToDouble(txtID2.Text); if (offSer.InsertOffsetData(offInfo)) { offSer.InsertOffsetDataLow(offInfo); txtID2.Text = ""; } } else if (i == 2) { offInfo.Offset_value = Convert.ToDouble(txtP1.Text); if (offSer.InsertOffsetData(offInfo)) { offSer.InsertOffsetDataLow(offInfo); txtP1.Text = ""; } } else { } } txtMasterNo.Text = ""; DropDownListModelName.SelectedIndex = 0; hisSer.InsertMasterHistory(offInfo.Offset_id, offInfo.Offset_user); } else { for (int i = 0; i < 3; i++) { offInfo.Offset_point = i; if (i == 0) { offInfo.Offset_value = Convert.ToDouble(txtID1.Text); if (offSer.UpdateOffsetData(offInfo, i)) { offSer.UpdateOffsetDataLow(offInfo, i); txtID1.Text = ""; } } else if (i == 1) { offInfo.Offset_value = Convert.ToDouble(txtID2.Text); if (offSer.UpdateOffsetData(offInfo, i)) { offSer.UpdateOffsetDataLow(offInfo, i); txtID2.Text = ""; } } else if (i == 2) { offInfo.Offset_value = Convert.ToDouble(txtP1.Text); if (offSer.UpdateOffsetData(offInfo, i)) { offSer.UpdateOffsetDataLow(offInfo, i); txtP1.Text = ""; } } else { } } Response.Redirect("MstMaster.aspx"); } } else { LabelErrorMasterNo.Text = "Please complete all fields."; } }