protected void btnAdd_Click(object sender, EventArgs e) { mmac = new MMachineAirCompressors(); bmac = new BMachineAirCompressors(); int Result = 0; mmac.MachineAirCompressorsId = 0; mmac.MachineAirCompressorsDate = Convert.ToDateTime(txtDate.Text.ToString()); mmac.MachineAirCompressorsShiftId = Convert.ToInt32(dpShiftDetails.SelectedItem.Value); mmac.StartingTime = string.IsNullOrEmpty(txtStartingTime.Text) ? string.Empty : txtStartingTime.Text; mmac.EndTime = string.IsNullOrEmpty(txtEndTime.Text) ? string.Empty : txtEndTime.Text; mmac.TotalHours = string.IsNullOrEmpty(txtTotalHours.Text) ? string.Empty : txtTotalHours.Text; mmac.flag = "insert"; Result = bmac.machineairdata(mmac); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Machine Air Compressors Data Added Successfully"; ScriptManager.RegisterStartupScript(this, this.GetType(), "sel3", "$('#bx2').removeClass('collapsed-box');", true); pnlError.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblSuccess.Text = "Something went wrong plz contact site admin"; pnlError.Update(); } }
protected void btnUpdate_Click(object sender, EventArgs e) { mmac = new MMachineAirCompressors(); bmac = new BMachineAirCompressors(); int Result = 0; mmac.MachineAirCompressorsId = string.IsNullOrEmpty(hId.Value) ? 0 : Convert.ToInt32(hId.Value); mmac.MachineAirCompressorsDate = Convert.ToDateTime(txtDate.Text.ToString()); mmac.MachineAirCompressorsShiftId = Convert.ToInt32(dpShiftDetails.SelectedItem.Value); mmac.StartingTime = string.IsNullOrEmpty(txtStartingTime.Text) ? string.Empty : txtStartingTime.Text; mmac.EndTime = string.IsNullOrEmpty(txtEndTime.Text) ? string.Empty : txtEndTime.Text; mmac.TotalHours = string.IsNullOrEmpty(txtTotalHours.Text) ? string.Empty : txtTotalHours.Text; mmac.flag = "Update"; Result = bmac.machineairdata(mmac); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Machine Air Compressors Data Updated Successfully"; pnlError.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblSuccess.Text = "Something went wrong plz contact site admin"; pnlError.Update(); } }
public int machineairdata(MMachineAirCompressors receive) { damac = new DAMachineAirCompressors(); int Result = 0; try { Result = damac.machineairdata(receive); } catch (Exception) { throw; } return(Result); }
public int machineairdata(MMachineAirCompressors receive) { int result = 0; try { DBParameterCollection paramcollection = new DBParameterCollection(); paramcollection.Add(new DBParameter("MachineAirCompressorsId", receive.MachineAirCompressorsId)); paramcollection.Add(new DBParameter("MachineAirCompressorsDate", receive.MachineAirCompressorsDate)); paramcollection.Add(new DBParameter("MachineAirCompressorsShiftId", receive.MachineAirCompressorsShiftId)); paramcollection.Add(new DBParameter("StartingTime", receive.StartingTime)); paramcollection.Add(new DBParameter("EndTime", receive.EndTime)); paramcollection.Add(new DBParameter("TotalHours", receive.TotalHours)); paramcollection.Add(new DBParameter("@flag", receive.flag)); result = _DBHelper.ExecuteNonQuery("sp_Prod_MachineAirCompressorsDetails", paramcollection, CommandType.StoredProcedure); } catch (Exception EX) { string MSG = EX.ToString(); } return(result); }