Esempio n. 1
0
        public List <IntakeProviderDocument> Select(gbmodel.user.User oUser, gbmodel.intakeprovider.IntakeProvider oProvider, gbmodel.casetype.CaseType oCasetype)
        {
            List <SqlParameter>           oParams = new List <SqlParameter>();
            List <IntakeProviderDocument> oList   = new List <IntakeProviderDocument>();

            oParams.Add(new SqlParameter("@i_provider_id", "" + oProvider.Id));
            oParams.Add(new SqlParameter("@sz_case_type_id", oCasetype.ID));
            oParams.Add(new SqlParameter("@sz_company_id", oUser.Account.ID));
            DataSet ds = null;

            ds = DBUtil.DataSet(dbconstant.Procedures.PR_INTAKE_DOCUMENT, oParams);
            if (ds != null)
            {
                IntakeProviderDocument oType;
                DataTable dt = ds.Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    oType = new IntakeProviderDocument();
                    DataRow dr = dt.Rows[i];
                    oType.Id   = "" + dr["i_document_id"];
                    oType.Name = "" + dr["sz_name"];
                    //oType.CreatedDate = Convert.ToDateTime(dr["dt_created"]);
                    //oType.CreatedBy = oUser;
                    //oType.Comapany = oUser.Account;
                    gbmodel.casetype.CaseType obj = new gbmodel.casetype.CaseType();
                    obj.ID         = "" + dr["sz_case_type_id"];
                    obj.Name       = "" + dr["sz_case_type_name"];
                    oType.CaseType = obj;

                    oList.Add(oType);
                }
            }
            return(oList);
        }
Esempio n. 2
0
        public List <gbmodel.casetype.CaseType> Select(gbmodel.user.User oUser)
        {
            SqlConnection sqlConnection            = null;
            List <gbmodel.casetype.CaseType> oList = new List <gbmodel.casetype.CaseType>();

            try
            {
                sqlConnection = new SqlConnection(DBUtil.ConnectionString);
                sqlConnection.Open();
                SqlCommand sqlCommand = null;
                sqlCommand             = new SqlCommand(Procedures.PR_SELECT_CASETYPE, sqlConnection);
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Parameters.Add(new SqlParameter("@sz_company_id", oUser.Account.ID));
                SqlDataAdapter da = new SqlDataAdapter(sqlCommand);
                DataSet        ds = new DataSet();
                da.Fill(ds);
                if (ds != null)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        DataRow dr = ds.Tables[0].Rows[i];
                        gbmodel.casetype.CaseType oElement = new gbmodel.casetype.CaseType();
                        oElement.Name = dr["Name"].ToString(); //to do
                        oElement.ID   = dr["ID"].ToString();   //TODO

                        oList.Add(oElement);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                if (sqlConnection.State == ConnectionState.Open)
                {
                    sqlConnection.Close();
                }
            }
            return(oList);
        }