/// <summary> /// To Update details of Maintainance in Maintainance table /// Created By : NirmalShah, 26-11-2015 /// Modified By : /// </summary> /// <param name="objMaintainanceBO"></param> /// <returns></returns> public ApplicationResult Maintainance_UpdateStatus(MaintainanceBo objMaintainanceBO, int intId) { try { pSqlParameter = new SqlParameter[17]; pSqlParameter[0] = new SqlParameter("@EquipmentTagNo", SqlDbType.VarChar); pSqlParameter[0].Direction = ParameterDirection.Input; pSqlParameter[0].Value = objMaintainanceBO.EquipmentTagNo; pSqlParameter[1] = new SqlParameter("@EquipmentName", SqlDbType.VarChar); pSqlParameter[1].Direction = ParameterDirection.Input; pSqlParameter[1].Value = objMaintainanceBO.EquipmentName; pSqlParameter[2] = new SqlParameter("@MaintainanceDate", SqlDbType.DateTime); pSqlParameter[2].Direction = ParameterDirection.Input; pSqlParameter[2].Value = objMaintainanceBO.MaintainanceDate; pSqlParameter[3] = new SqlParameter("@StartTime", SqlDbType.DateTime); pSqlParameter[3].Direction = ParameterDirection.Input; pSqlParameter[3].Value = objMaintainanceBO.StartTime; pSqlParameter[4] = new SqlParameter("@EndTime", SqlDbType.DateTime); pSqlParameter[4].Direction = ParameterDirection.Input; pSqlParameter[4].Value = objMaintainanceBO.EndTime; pSqlParameter[5] = new SqlParameter("@PartNo", SqlDbType.VarChar); pSqlParameter[5].Direction = ParameterDirection.Input; pSqlParameter[5].Value = objMaintainanceBO.PartNo; pSqlParameter[6] = new SqlParameter("@PartName", SqlDbType.VarChar); pSqlParameter[6].Direction = ParameterDirection.Input; pSqlParameter[6].Value = objMaintainanceBO.PartName; pSqlParameter[7] = new SqlParameter("@Section", SqlDbType.VarChar); pSqlParameter[7].Direction = ParameterDirection.Input; pSqlParameter[7].Value = objMaintainanceBO.Section; pSqlParameter[8] = new SqlParameter("@Area", SqlDbType.VarChar); pSqlParameter[8].Direction = ParameterDirection.Input; pSqlParameter[8].Value = objMaintainanceBO.Area; pSqlParameter[9] = new SqlParameter("@Department", SqlDbType.VarChar); pSqlParameter[9].Direction = ParameterDirection.Input; pSqlParameter[9].Value = objMaintainanceBO.Department; pSqlParameter[10] = new SqlParameter("@ActionTaken", SqlDbType.VarChar); pSqlParameter[10].Direction = ParameterDirection.Input; pSqlParameter[10].Value = objMaintainanceBO.ActionTaken; pSqlParameter[11] = new SqlParameter("@RectifiedBy", SqlDbType.VarChar); pSqlParameter[11].Direction = ParameterDirection.Input; pSqlParameter[11].Value = objMaintainanceBO.RectifiedBy; pSqlParameter[12] = new SqlParameter("@Remark", SqlDbType.VarChar); pSqlParameter[12].Direction = ParameterDirection.Input; pSqlParameter[12].Value = objMaintainanceBO.Remark; pSqlParameter[13] = new SqlParameter("@Type", SqlDbType.Int); pSqlParameter[13].Direction = ParameterDirection.Input; pSqlParameter[13].Value = objMaintainanceBO.Type; pSqlParameter[14] = new SqlParameter("@LastModifiedBy", SqlDbType.Int); pSqlParameter[14].Direction = ParameterDirection.Input; pSqlParameter[14].Value = objMaintainanceBO.CreatedBy; pSqlParameter[15] = new SqlParameter("@LastModifiedDate", SqlDbType.DateTime); pSqlParameter[15].Direction = ParameterDirection.Input; pSqlParameter[15].Value = objMaintainanceBO.CreatedDate; pSqlParameter[16] = new SqlParameter("@Id", SqlDbType.Int); pSqlParameter[16].Direction = ParameterDirection.Input; pSqlParameter[16].Value = intId; strStoredProcName = "usp_Maintainance_UpdateStatus"; DataTable dtResult = new DataTable(); dtResult = Database.ExecuteDataTable(CommandType.StoredProcedure, strStoredProcName, pSqlParameter); ApplicationResult objResults = new ApplicationResult(dtResult); objResults.Status = ApplicationResult.CommonStatusType.Success; return(objResults); } catch (Exception ex) { throw ex; } }
protected void btnSave_OnClick(object sender, EventArgs e) { try { MaintainanceBo objBreakdowneMaintainanceBo = new MaintainanceBo(); //ApplicationResult objResult = new ApplicationResult(); MaintainanceBL objBreakdowneMaintainanceBl = new MaintainanceBL(); objBreakdowneMaintainanceBo.EquipmentTagNo = (txtEquipmentNo.Text.Trim()); objBreakdowneMaintainanceBo.EquipmentName = (txtEquipmentName.Text.Trim()); objBreakdowneMaintainanceBo.MaintainanceDate = DateTime.ParseExact(txtMaintainanceDate.Text.Trim(), "dd/MM/yyyy", CultureInfo.InvariantCulture); objBreakdowneMaintainanceBo.StartTime = DateTime.ParseExact(txtStartDate.Text.Trim(), "HH:mm:ss", CultureInfo.InvariantCulture); objBreakdowneMaintainanceBo.EndTime = DateTime.ParseExact(txtEndDate.Text.Trim(), "HH:mm:ss", CultureInfo.InvariantCulture); objBreakdowneMaintainanceBo.PartNo = txtPartNo.Text.Trim(); objBreakdowneMaintainanceBo.PartName = txtPartName.Text.Trim(); objBreakdowneMaintainanceBo.Section = txtSection.Text.Trim(); objBreakdowneMaintainanceBo.Cause = txtCause.Text.Trim(); objBreakdowneMaintainanceBo.DetailBreakDown = txtDetailBreakdown.Text.Trim(); objBreakdowneMaintainanceBo.Area = txtArea.Text.Trim(); objBreakdowneMaintainanceBo.Department = txtDepartment.Text.Trim(); objBreakdowneMaintainanceBo.ActionTaken = txtAction.Text.Trim(); objBreakdowneMaintainanceBo.RectifiedBy = txtRectified.Text.Trim(); objBreakdowneMaintainanceBo.Remark = txtRemark.Text.Trim(); objBreakdowneMaintainanceBo.UserId = Convert.ToInt32(Session[ApplicationSession.Userid]); objBreakdowneMaintainanceBo.Type = 1; objBreakdowneMaintainanceBo.IsBreackDown = 1; switch (ViewState["Mode"].ToString()) { case "Save": objBreakdowneMaintainanceBo.CreatedBy = Convert.ToInt32(Session[ApplicationSession.Userid]); objBreakdowneMaintainanceBo.CreatedDate = DateTime.UtcNow.AddHours(5.5); break; case "Edit": objBreakdowneMaintainanceBo.LastModifiedBy = Convert.ToInt32(Session[ApplicationSession.Userid]); objBreakdowneMaintainanceBo.LastModifiedDate = DateTime.UtcNow.AddHours(5.5); break; } if (ViewState["Mode"].ToString() == "Save") { var objResult = objBreakdowneMaintainanceBl.Maintainance_Insert_ForBreakdown(objBreakdowneMaintainanceBo); if (objResult.Status == ApplicationResult.CommonStatusType.Success) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Saved Successfully.');</script>"); ClearAll(); BindgvBreakdowneMaintainance(); // PanelVisibilityMode(true, false); } } else if (ViewState["Mode"].ToString() == "Edit") { objBreakdowneMaintainanceBo.Id = Convert.ToInt32(ViewState["BreakdowneMaintainanceID"].ToString()); var objResult = objBreakdowneMaintainanceBl.Maintainance_Update_ForBreakdown(objBreakdowneMaintainanceBo); if (objResult.Status == ApplicationResult.CommonStatusType.Success) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Updated Successfully.');</script>"); ClearAll(); BindgvBreakdowneMaintainance(); // PanelVisibilityMode(true, false); } } } catch (Exception ex) { log.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical Problem. Contact to your Administrator.');</script>"); } }
/// <summary> /// To Insert details of Maintainance in Maintainance table /// Created By : NirmalShah, 26-11-2015 /// Modified By : /// </summary> /// <param name="objMaintainanceBO"></param> /// <returns></returns> public ApplicationResult Maintainance_Insert_ForBreakdown(MaintainanceBo objMaintainanceBO) { try { pSqlParameter = new SqlParameter[19]; pSqlParameter[0] = new SqlParameter("@EquipmentTagNo", SqlDbType.VarChar); pSqlParameter[0].Direction = ParameterDirection.Input; pSqlParameter[0].Value = objMaintainanceBO.EquipmentTagNo; pSqlParameter[1] = new SqlParameter("@EquipmentName", SqlDbType.VarChar); pSqlParameter[1].Direction = ParameterDirection.Input; pSqlParameter[1].Value = objMaintainanceBO.EquipmentName; pSqlParameter[2] = new SqlParameter("@MaintainanceDate", SqlDbType.DateTime); pSqlParameter[2].Direction = ParameterDirection.Input; pSqlParameter[2].Value = objMaintainanceBO.MaintainanceDate; pSqlParameter[3] = new SqlParameter("@StartTime", SqlDbType.DateTime); pSqlParameter[3].Direction = ParameterDirection.Input; pSqlParameter[3].Value = objMaintainanceBO.StartTime; pSqlParameter[4] = new SqlParameter("@EndTime", SqlDbType.DateTime); pSqlParameter[4].Direction = ParameterDirection.Input; pSqlParameter[4].Value = objMaintainanceBO.EndTime; pSqlParameter[5] = new SqlParameter("@PartNo", SqlDbType.VarChar); pSqlParameter[5].Direction = ParameterDirection.Input; pSqlParameter[5].Value = objMaintainanceBO.PartNo; pSqlParameter[6] = new SqlParameter("@PartName", SqlDbType.VarChar); pSqlParameter[6].Direction = ParameterDirection.Input; pSqlParameter[6].Value = objMaintainanceBO.PartName; pSqlParameter[7] = new SqlParameter("@Section", SqlDbType.VarChar); pSqlParameter[7].Direction = ParameterDirection.Input; pSqlParameter[7].Value = objMaintainanceBO.Section; pSqlParameter[8] = new SqlParameter("@Cause", SqlDbType.VarChar); pSqlParameter[8].Direction = ParameterDirection.Input; pSqlParameter[8].Value = objMaintainanceBO.Cause; pSqlParameter[9] = new SqlParameter("@DetailBreakDown", SqlDbType.VarChar); pSqlParameter[9].Direction = ParameterDirection.Input; pSqlParameter[9].Value = objMaintainanceBO.DetailBreakDown; pSqlParameter[10] = new SqlParameter("@ActionTaken", SqlDbType.VarChar); pSqlParameter[10].Direction = ParameterDirection.Input; pSqlParameter[10].Value = objMaintainanceBO.ActionTaken; pSqlParameter[11] = new SqlParameter("@RectifiedBy", SqlDbType.VarChar); pSqlParameter[11].Direction = ParameterDirection.Input; pSqlParameter[11].Value = objMaintainanceBO.RectifiedBy; pSqlParameter[12] = new SqlParameter("@Remark", SqlDbType.VarChar); pSqlParameter[12].Direction = ParameterDirection.Input; pSqlParameter[12].Value = objMaintainanceBO.Remark; pSqlParameter[13] = new SqlParameter("@Department", SqlDbType.VarChar); pSqlParameter[13].Direction = ParameterDirection.Input; pSqlParameter[13].Value = objMaintainanceBO.Department; pSqlParameter[14] = new SqlParameter("@CreatedBy", SqlDbType.Int); pSqlParameter[14].Direction = ParameterDirection.Input; pSqlParameter[14].Value = objMaintainanceBO.CreatedBy; pSqlParameter[15] = new SqlParameter("@CreatedDate", SqlDbType.DateTime); pSqlParameter[15].Direction = ParameterDirection.Input; pSqlParameter[15].Value = objMaintainanceBO.CreatedDate; pSqlParameter[16] = new SqlParameter("@Area", SqlDbType.VarChar); pSqlParameter[16].Direction = ParameterDirection.Input; pSqlParameter[16].Value = objMaintainanceBO.Area; pSqlParameter[17] = new SqlParameter("@UserId", SqlDbType.Int); pSqlParameter[17].Direction = ParameterDirection.Input; pSqlParameter[17].Value = objMaintainanceBO.UserId; pSqlParameter[18] = new SqlParameter("@IsBreakDown", SqlDbType.Int); pSqlParameter[18].Direction = ParameterDirection.Input; pSqlParameter[18].Value = objMaintainanceBO.IsBreackDown; sSql = "usp_Maintainance_Insert"; //DataTable dtResult = new DataTable(); //dtResult = Database.ExecuteDataTable(CommandType.StoredProcedure, sSql, pSqlParameter); //ApplicationResult objResults = new ApplicationResult(dtResult); //objResults.Status = ApplicationResult.CommonStatusType.Success; //return objResults; int iResult = Database.ExecuteNonQuery(CommandType.StoredProcedure, sSql, pSqlParameter); if (iResult > 0) { ApplicationResult objResults = new ApplicationResult(); objResults.Status = ApplicationResult.CommonStatusType.Success; return(objResults); } else { ApplicationResult objResults = new ApplicationResult(); objResults.Status = ApplicationResult.CommonStatusType.Failure; return(objResults); } } catch (Exception ex) { throw ex; } finally { objMaintainanceBO = null; } }
protected void btnSave_OnClick(object sender, EventArgs e) { try { if (Page.IsValid) { MaintainanceBo objRoutineMaintainanceBo = new MaintainanceBo(); MaintainanceBL objRoutineMaintainanceBl = new MaintainanceBL(); objRoutineMaintainanceBo.EquipmentTagNo = (txtEquipmentNo.Text.Trim()); objRoutineMaintainanceBo.EquipmentName = (txtEquipmentName.Text.Trim()); objRoutineMaintainanceBo.MaintainanceDate = DateTime.ParseExact(txtMaintainanceDate.Text.Trim(), "dd/MM/yyyy", CultureInfo.InvariantCulture); objRoutineMaintainanceBo.StartTime = DateTime.ParseExact(txtStartDate.Text.Trim(), "HH:mm:ss", CultureInfo.InvariantCulture); objRoutineMaintainanceBo.EndTime = DateTime.ParseExact(txtEndDate.Text.Trim(), "HH:mm:ss", CultureInfo.InvariantCulture); objRoutineMaintainanceBo.PartNo = txtPartNo.Text.Trim(); objRoutineMaintainanceBo.PartName = txtPartName.Text.Trim(); objRoutineMaintainanceBo.Section = txtSection.Text.Trim(); objRoutineMaintainanceBo.DueDate = DateTime.ParseExact(txtDueDate.Text.Trim(), "dd/MM/yyyy", CultureInfo.InvariantCulture); objRoutineMaintainanceBo.NextDueDate = DateTime.ParseExact(txtNextDueDate.Text.Trim(), "dd/MM/yyyy", CultureInfo.InvariantCulture); objRoutineMaintainanceBo.Department = txtDepartment.Text.Trim(); objRoutineMaintainanceBo.Area = txtArea.Text.Trim(); //objRoutineMaintainanceBo.DueDate = DateTime.ParseExact(txtDueDate.Text.Trim(), "dd/MM/yyyy", // CultureInfo.InvariantCulture); //objRoutineMaintainanceBo.NextDueDate = (txtNextDueDate.Text != "") // ? DateTime.ParseExact(txtNextDueDate.Text.Trim(), "dd/MM/yyyy", CultureInfo.InvariantCulture) // : DateTime.ParseExact("01/01/2015", "dd/MM/yyyy", CultureInfo.InvariantCulture); //objRoutineMaintainanceBo.NextDueDate = ; objRoutineMaintainanceBo.ActionTaken = txtAction.Text.Trim(); objRoutineMaintainanceBo.RectifiedBy = txtRectified.Text.Trim(); objRoutineMaintainanceBo.Remark = txtRemark.Text.Trim(); objRoutineMaintainanceBo.Type = 0; objRoutineMaintainanceBo.UserId = Convert.ToInt32(Session[ApplicationSession.Userid]); objRoutineMaintainanceBo.IsBreackDown = 0; if (ViewState["Mode"].ToString() == "Save") { objRoutineMaintainanceBo.CreatedBy = Convert.ToInt32(Session[ApplicationSession.Userid]); objRoutineMaintainanceBo.CreatedDate = DateTime.UtcNow.AddHours(5.5); var objResult = objRoutineMaintainanceBl.Maintainance_Insert(objRoutineMaintainanceBo); if (objResult.Status == ApplicationResult.CommonStatusType.Success) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Saved Successfully.');</script>"); ClearAll(); BindgvRoutineMaintainance(); PanelVisibilityMode(true, false); } } else if (ViewState["Mode"].ToString() == "Edit") { objRoutineMaintainanceBo.LastModifiedBy = Convert.ToInt32(Session[ApplicationSession.Userid]); objRoutineMaintainanceBo.LastModifiedDate = DateTime.UtcNow.AddHours(5.5); objRoutineMaintainanceBo.Id = Convert.ToInt32(ViewState["RoutineMaintainanceID"].ToString()); var objResult = objRoutineMaintainanceBl.Maintainance_Update(objRoutineMaintainanceBo); if (objResult.Status == ApplicationResult.CommonStatusType.Success) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Updated Successfully.');</script>"); ClearAll(); BindgvRoutineMaintainance(); PanelVisibilityMode(true, false); } } else if (ViewState["Mode"].ToString() == "Status") { objRoutineMaintainanceBo.CreatedBy = Convert.ToInt32(Session[ApplicationSession.Userid]); objRoutineMaintainanceBo.CreatedDate = DateTime.UtcNow.AddHours(5.5); MaintainanceBL objRoutineMaintainanceBL = new MaintainanceBL(); var objResult = objRoutineMaintainanceBL.Maintainance_UpdateStatus(objRoutineMaintainanceBo, Convert.ToInt32(ViewState["RoutineStatusID"].ToString())); if (objResult.Status == ApplicationResult.CommonStatusType.Success) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Routine Maintainance status change Successfully.');</script>"); PanelVisibilityMode(true, false); BindgvRoutineMaintainance(); } } } } catch (Exception ex) { log.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical Problem. Contact to your Administrator.');</script>"); } }