public int SaveOTSetup(OtSetup service) { Query = "INSERT INTO [tbl_OtSetup]([Pid],[OtReffNo],[Cabin_Bed],[Date],[SurgenId],[Anstology],[FirstAsst],[SecondAsst],[OpName],[OT_From],[OT_To],[userId])" + "VALUES (@Pid,@OtReffNo,@Cabin_Bed,@Date,@SurgenId,@Anstology,@FirstAsst,@SecondAsst,@OpName,@OT_From,@OT_To,@userId)"; Command = new SqlCommand(Query, Connection); Command.CommandType = CommandType.Text; Command.Parameters.AddWithValue("@Pid", service.Pid); Command.Parameters.AddWithValue("@OtReffNo", service.OtReffNo); Command.Parameters.AddWithValue("@Cabin_Bed", service.Cabin_Bed); Command.Parameters.AddWithValue("@Date", service.Date); Command.Parameters.AddWithValue("@SurgenId", service.SurgenId); Command.Parameters.AddWithValue("@Anstology", service.Anstology); Command.Parameters.AddWithValue("@FirstAsst", service.FirstAsst); Command.Parameters.AddWithValue("@SecondAsst", service.SecondAsst); Command.Parameters.AddWithValue("@OpName", service.OpName); Command.Parameters.AddWithValue("@OT_From", service.OT_From); Command.Parameters.AddWithValue("@OT_To", service.OT_To); Command.Parameters.AddWithValue("@userId", service.userId ?? ""); int count = Command.ExecuteNonQuery(); return(count); }
public MessageModel SaveOT_Setup(OtSetup _OtSetup) { int saveCount = new OTGateway().SaveOTSetup(_OtSetup); MessageModel messageModel = new MessageModel(); if (saveCount > 0) { messageModel.MessageTitle = "Successfull"; messageModel.MessageBody = "OT Setup information saved successfully!"; } return(messageModel); }
public OtSetup GetOtSetupByPatientId(string pid) { DataTable listOfOtSetup = new OTGateway().GetOtSetupByPatientId(pid); OtSetup setup = new OtSetup(); if (listOfOtSetup.Rows.Count > 0) { setup.Pid = listOfOtSetup.Rows[0]["OPID"].ToString(); setup.OtReffNo = listOfOtSetup.Rows[0]["OtRefNo"].ToString(); setup.Cabin_Bed = listOfOtSetup.Rows[0]["BedName"].ToString(); setup.Date = Convert.ToDateTime(listOfOtSetup.Rows[0]["OtDate"].ToString()); setup.SurgenId = listOfOtSetup.Rows[0]["DoctorName"].ToString(); setup.Anstology = listOfOtSetup.Rows[0]["AnthName"].ToString(); setup.FirstAsst = listOfOtSetup.Rows[0]["FirstAsstName"].ToString(); setup.SecondAsst = listOfOtSetup.Rows[0]["SecondAssist"].ToString(); setup.OpName = listOfOtSetup.Rows[0]["OperationName"].ToString(); setup.OT_From = TimeSpan.Parse(listOfOtSetup.Rows[0]["OperationTime"].ToString()); setup.OT_To = TimeSpan.Parse(listOfOtSetup.Rows[0]["ToTime"].ToString()); } return(setup); }