Beispiel #1
0
        string ICLRService.UpdateRoundingLogForRoom(CLRUpdateRoundingRoomEntity objCLRUpdateRoundingRoomEntity)
        {
            try
            {
                int RowInserterd = 0;
                string UserName = ServiceSecurityContext.Current.PrimaryIdentity.Name;//Get Currtnt User Name.
                objCLRUpdateRoundingRoomEntity.UpdateOpertr = UserName;
                SqlConnection Conn = new SqlConnection(_ConnetctionString);//Create Connection with db.
                Conn.Open();
                SqlCommand Cmd = new SqlCommand("sp_UpdateRoundingLogForRoom", Conn);//Using SP from DB.
                Cmd.CommandType = CommandType.StoredProcedure;
                Cmd.Parameters.AddWithValue("@EnteredByID", UserName);
                Cmd.Parameters.AddWithValue("@CLR_ID", Convert.ToInt32(objCLRUpdateRoundingRoomEntity.ClR_ID));
                Cmd.Parameters.AddWithValue("@CLRStatusCode", objCLRUpdateRoundingRoomEntity.CLRStatusCode);
                Cmd.Parameters.AddWithValue("@NurseNote", objCLRUpdateRoundingRoomEntity.NurseNote);
                Cmd.Parameters.AddWithValue("@UpdateDate", Convert.ToDateTime(DateTime.Now.ToShortDateString()));
                Cmd.Parameters.AddWithValue("@UpdateOpertr", objCLRUpdateRoundingRoomEntity.UpdateOpertr);
                //Passing parameters to sp.

                RowInserterd = Cmd.ExecuteNonQuery();// Get affected row index.
                Conn.Close();//Connection Closed.
                return RowInserterd.ToString();//Returning Result.
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }
Beispiel #2
0
        string LocalMarkStatusForRoom(CLRUpdateRoundingRoomEntity objCLRUpdateRoundingRoomEntity, SqlConnection Conn, SqlTransaction myTran)
        {
            int RowInserterd = 0;

            SqlCommand Cmd = new SqlCommand("sp_InsertMarkStatusForRoom", Conn, myTran);//Using SP from DB.

            string UserName = ServiceSecurityContext.Current.PrimaryIdentity.Name;//Get Currtnt User Name.
            objCLRUpdateRoundingRoomEntity.UpdateOpertr = UserName;
            Cmd.CommandType = CommandType.StoredProcedure;
            Cmd.Parameters.AddWithValue("@RoomID", Convert.ToInt32(objCLRUpdateRoundingRoomEntity.RoomID));
            Cmd.Parameters.AddWithValue("@Date", objCLRUpdateRoundingRoomEntity.CLRDateTime);
            Cmd.Parameters.AddWithValue("@EnteredByID", UserName);
            Cmd.Parameters.AddWithValue("@RoundingRoomStatus", objCLRUpdateRoundingRoomEntity.RoomStatusCode);
            Cmd.Parameters.AddWithValue("@UpdateDate", DateTime.Now.ToShortDateString());
            Cmd.Parameters.AddWithValue("@UpdateOpertr", objCLRUpdateRoundingRoomEntity.UpdateOpertr);
            //Passing parameters to sp.
            RowInserterd = Cmd.ExecuteNonQuery();// Get affected row index.
            Conn.Close();//Connection Closed.
            //Conn = null;
            //Cmd = null;
            return RowInserterd.ToString();//Returning Result.
        }
Beispiel #3
0
        string ICLRService.MassUpdateRoundingRoomStatus(CLRMassUpdateRoundingRoomEntity objCLRMassUpdateRoundingRoomEntity)
        {
            SqlConnection Conn = null;
            SqlTransaction myTran = null;
            try
            {
                Conn = new SqlConnection(_ConnetctionString);//Create Connection with db.
                Conn.Open();

                myTran = Conn.BeginTransaction();

                string strReturn = string.Empty;
                //all rooms
                string strMassUpdate = objCLRMassUpdateRoundingRoomEntity.MassUpdate;
                if (strMassUpdate.Length > 0)
                {
                    string[] SplitString = strMassUpdate.Split(';');
                    if (SplitString.Length > 0)
                    {
                        foreach (string strFields in SplitString)
                        {
                            //all fields
                            string[] strAllFields = strFields.Split(',');
                            if (strAllFields.Length == 3)
                            {

                                string  roomid = string.Empty;
                                string roundingdate = string.Empty;
                                string roomstatus = string.Empty;

                                CLRUpdateRoundingRoomEntity obj = new CLRUpdateRoundingRoomEntity();
                                obj.RoomID = strAllFields[0];
                                obj.CLRDateTime = strAllFields[1];
                                obj.RoomStatusCode = strAllFields[2];

                                strReturn = strReturn + LocalMarkStatusForRoom(obj, Conn, myTran);
                                strReturn = strReturn + ",";

                            }
                        }
                        strReturn = strReturn.Remove(strReturn.Length - 1);
                        myTran.Commit();
                        Conn.Close();
                    }

                }
                return strReturn;
            }
            catch (Exception ex)
            {
                try
                {
                    myTran.Rollback();
                }
                catch (Exception ex2)
                {
                    return ex2.Message;
                }

                return ex.Message;
            }
        }