//public static List<ATTAppointmentStatus> GetAppointmentStatusList(int? statusId) //{ // List<ATTAppointmentStatus> appntList = new List<ATTAppointmentStatus>(); // try // { // DataTable dt =DLLAppointmentStatus.GetAppointmentStatusList(statusId); // foreach (DataRow row in dt.Rows) // { // ATTAppointmentStatus obj = new ATTAppointmentStatus(); // obj.AppointmentStatusID = int.Parse(row["STATUS_ID"].ToString()); // obj.AppointmentStatusName = row["STATUS_NAME"].ToString(); // obj.AppointmentStatusColor = row["STATUS_COLOR"].ToString(); // appntList.Add(obj); // } // return appntList; // } // catch (Exception ex) // { // throw ex; // } //} public static List <ATTAppointmentStatus> GetMeetingStatusList(int?id, bool containDefault) { List <ATTAppointmentStatus> lst = new List <ATTAppointmentStatus>(); try { foreach (DataRow row in DLLAppointmentStatus.GetAppointmentStatusTable(id).Rows) { ATTAppointmentStatus obj = new ATTAppointmentStatus(); obj.AppointmentStatusID = int.Parse(row["STATUS_ID"].ToString()); obj.AppointmentStatusName = row["STATUS_NAME"].ToString(); obj.AppointmentStatusColor = row["STATUS_COLOR"].ToString(); lst.Add(obj); } if (lst.Count > 0 && containDefault == true) { ATTAppointmentStatus def = new ATTAppointmentStatus(); def.AppointmentStatusID = -1; def.AppointmentStatusName = "छान्नुहोस्"; lst.Insert(0, def); } return(lst); } catch (Exception ex) { throw ex; } }
public static bool AddAppointmentStatus(ATTAppointmentStatus obj) { try { return(DLLAppointmentStatus.AddAppointmentStatus(obj)); } catch (Exception ex) { throw ex; } }
protected void btnSubmit_Click(object sender, EventArgs e) { ATTAppointmentStatus attObj = new ATTAppointmentStatus(); attObj.AppointmentStatusName = txtAppointmentStatus.Text; attObj.AppointmentStatusColor = ColorPicker.Color.ToString(); if (lstAppointmentStatus.SelectedIndex < 0) { //add attObj.Action = "A"; } else if (lstAppointmentStatus.SelectedIndex > -1) { //edit attObj.Action = "E"; attObj.AppointmentStatusID = int.Parse(this.lstAppointmentStatus.SelectedValue); } ObjectValidation result = BLLAppointmentStatus.Validate(attObj); if (result.IsValid == false) { this.lblStatusMessage.Text = result.ErrorMessage; this.programmaticModalPopup.Show(); return; } try { BLLAppointmentStatus.AddAppointmentStatus(attObj); } catch (Exception ex) { throw ex; } List <ATTAppointmentStatus> lst = (List <ATTAppointmentStatus>)Session["AppointmentStatus"]; if (this.lstAppointmentStatus.SelectedIndex > -1) { lst[this.lstAppointmentStatus.SelectedIndex].AppointmentStatusName = attObj.AppointmentStatusName; lst[this.lstAppointmentStatus.SelectedIndex].AppointmentStatusID = attObj.AppointmentStatusID; } else { lst.Add(attObj); } this.lstAppointmentStatus.DataSource = lst; lstAppointmentStatus.DataBind(); ClearControls(); }
public static ObjectValidation Validate(ATTAppointmentStatus obj) { ObjectValidation result = new ObjectValidation(); if (obj.AppointmentStatusName == "") { result.IsValid = false; result.ErrorMessage = "Appointment status name cannot be blank."; return(result); } return(result); }
public static bool AddAppointmentStatus(ATTAppointmentStatus objAppntStatus) { string SPInsertUpdate = ""; if (objAppntStatus.Action == "A") { SPInsertUpdate = "SP_ADD_APPOINTMENT_STATUS"; } else if (objAppntStatus.Action == "E") { SPInsertUpdate = "SP_EDIT_APPOINTMENT_STATUS"; } OracleParameter[] paramArray = new OracleParameter[3]; paramArray[0] = Utilities.GetOraParam("P_STATUS_ID", objAppntStatus.AppointmentStatusID, OracleDbType.Int16, ParameterDirection.InputOutput); paramArray[1] = Utilities.GetOraParam("P_STATUS_NAME", objAppntStatus.AppointmentStatusName, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam("P_STATUS_COLOR", objAppntStatus.AppointmentStatusColor, OracleDbType.Varchar2, ParameterDirection.Input); GetConnection DBConn = new GetConnection(); OracleConnection Conn = DBConn.GetDbConn(Module.OAS); try { SqlHelper.ExecuteNonQuery(Conn, CommandType.StoredProcedure, SPInsertUpdate, paramArray); objAppntStatus.AppointmentStatusID = int.Parse(paramArray[0].Value.ToString()); return(true); } catch (Exception ex) { throw ex; } finally { DBConn.CloseDbConn(); } }