protected void btnAddObjectMnt_Click(object sender, EventArgs e) { try { ObjectMaintenanceModel model = new ObjectMaintenanceModel(); model.MainId = 0; model.ObjectID = Convert.ToInt32(ddlObject.SelectedValue); model.IssueComments = txtIssueComment.Text; model.IssueDateTime = Convert.ToDateTime(txtIssuedt.Text); model.IssueAuthor = txtIssueAuthor.Text; model.ResolvedComments = ""; model.ResolvedDateTime = DateTime.Now; model.ResolvedPerson = ""; bool status = obj.postObjectMaintenance(model); if (status == true) { Alert = AlertsClass.SuccessAdd; } else { Alert = AlertsClass.ErrorWentWrong; } clearControls(); gridBind(); allowStaticMethods("staticMethod();ALerts('" + Alert + "');applyDatatable('.gvdObjectMntClass');"); } catch (Exception) { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); } }
protected void linkbtnEdit_Command(object sender, CommandEventArgs e) { try { if (e.CommandName == "UpdateID") { int ID = Convert.ToInt32(e.CommandArgument); ObjectMaintenanceModel model = obj.getObjectMaintenanceByID(ID); if (model.isActive == true) { txtResolveId.Text = e.CommandArgument.ToString(); txtResolveId.Enabled = false; allowStaticMethods("openResolveModal();staticMethod();applyDatatable('.gvdObjectMntClass');"); } if (model.isActive == false) { lblResolvedComments.Text = model.ResolvedComments; lblResolvedPerson.Text = model.ResolvedPerson; lblResolvedDateTime.Text = Convert.ToString(model.ResolvedDateTime); allowStaticMethods("openResolvedModal();staticMethod();applyDatatable('.gvdObjectMntClass');"); } } } catch (Exception) { BindingClass.ExceptionAlertScriptManager(this.Page, this.GetType()); } }
public ObjectMaintenanceModel getObjectMaintenanceByID(int mainId) { ObjectMaintenanceModel model = new ObjectMaintenanceModel(); string query = "select * from [objectMaintenanceLog] where MainId = @MainId"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@MainId", mainId), }; using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand(query, CommandType.Text, parameters)) { if (table.Rows.Count == 1) { DataRow row = table.Rows[0]; model.MainId = Convert.ToInt32(row["MainId"]); model.ObjectID = Convert.ToInt32(row["ObjectID"]); model.IssueComments = row["IssueComments"].ToString(); model.IssueDateTime = Convert.ToDateTime(row["IssueDateTime"]); model.IssueAuthor = row["IssueAuthor"].ToString(); model.ResolvedComments = row["ResolvedComments"].ToString(); model.ResolvedDateTime = Convert.ToDateTime(row["ResolvedDateTime"]); model.ResolvedPerson = row["ResolvedPerson"].ToString(); model.isActive = Convert.ToBoolean(row["isActive"]); } } return(model); }
public bool postObjectMaintenance(ObjectMaintenanceModel _object) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@MainId", _object.MainId), new SqlParameter("@ObjectID", _object.ObjectID), new SqlParameter("@IssueComments", _object.IssueComments), new SqlParameter("@IssueDateTime", _object.IssueDateTime), new SqlParameter("@IssueAuthor", _object.IssueAuthor), new SqlParameter("@ResolvedComments", _object.ResolvedComments), new SqlParameter("@ResolvedDateTime", _object.ResolvedDateTime), new SqlParameter("@ResolvedPerson", _object.ResolvedPerson), }; return(DBHelper.ExecuteNonQuery("uspPost_objectMaintenanceLog", CommandType.StoredProcedure, parameters)); }
public List <ObjectMaintenanceModel> getObjectMaintenanceByObject(int objectID) { List <ObjectMaintenanceModel> list = new List <ObjectMaintenanceModel>(); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ObjectID", objectID), }; using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("uspGET_ObjectMaintenanceLog", CommandType.StoredProcedure, parameters)) { if (table.Rows.Count > 0) { foreach (DataRow row in table.Rows) { ObjectMaintenanceModel model = new ObjectMaintenanceModel(); model.MainId = Convert.ToInt32(row["MainId"]); model.ObjectID = Convert.ToInt32(row["ObjectID"]); model.IssueComments = row["IssueComments"].ToString(); model.IssueDateTime = Convert.ToDateTime(row["IssueDateTime"]); model.IssueAuthor = row["IssueAuthor"].ToString(); model.ResolvedComments = row["ResolvedComments"].ToString(); model.ResolvedDateTime = Convert.ToDateTime(row["ResolvedDateTime"]); model.ResolvedPerson = row["ResolvedPerson"].ToString(); model.isActive = Convert.ToBoolean(row["isActive"]); if (model.isActive == true) { model.cssClass = "btn btn-danger btn-xs"; model.linkbtnText = "Resolve"; } else { model.cssClass = "btn btn-success btn-xs"; model.linkbtnText = "Resolved"; } list.Add(model); } } } return(list); }
public bool postObjectMaintenance(ObjectMaintenanceModel _object) { return(obj.postObjectMaintenance(_object)); }