Ejemplo n.º 1
0
        public object GetDropdownListByRoleName(string roleName)
        {
            try
            {
                string             query   = null;
                TextCaseConversion convert = new TextCaseConversion();
                if ((roleName == "Admin") || (roleName == "System Admin") || (roleName == "Super Admin"))
                {
                    query = "Select Name as Label, Id as Value from " + mainDbUser.DbUser + "role";
                }
                else
                {
                    query = "Select Name as Label, Id as Value from " + mainDbUser.DbUser + "role where Name in ('Branch Teller','Branch KYC Maker','Branch KYC Checker')";
                }


                using (var connection = this.GetConnection())
                {
                    var list = connection.Query <DropdownListModel>(query);

                    this.CloseConnection(connection);
                    return(list);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public object GetGlobalSearchResult(string option, string criteria, string filter)
        {
            try
            {
                using (var connection = this.GetConnection())
                {
                    TextCaseConversion convert = new TextCaseConversion();
                    string             query;
                    switch (option)
                    {
                    case "Transaction":
                        if (criteria == "Mphone")
                        {
                            query = "Select Trans_no, Trans_date, Trans_From, trans_To,ROUND(pay_amt,3) as pay_amount from " + dbUser + "gl_trans_mst where Trans_From like '%" + filter + "%' or trans_To like '%" + filter + "%' order by trans_date desc ";
                        }
                        else
                        {
                            query = "Select Trans_no, Trans_date, Trans_From, trans_To,ROUND(pay_amt,3) as pay_amount from " + dbUser + "gl_trans_mst where Trans_no like '%" + filter + "%' order by trans_date desc ";
                        }
                        break;

                    case "Message":
                        query = "Select mphone,out_msg,out_time from " + dbUser + "outbox where " + convert.ToPascalCase(criteria) + " like '%" + filter + "%' and out_time is not null order by out_time desc";
                        break;

                    case "RegInfo":
                        query = "select mphone, Reg_date, ROUND(Balance_M,3) as Balance_M, Name, mphone as Details from " + dbUser + "regInfo where " + convert.ToPascalCase(criteria) + " like '%" + filter + "%' order by reg_date desc";
                        break;

                    default:
                        query = "select mphone, Reg_date, ROUND(Balance_M,3) as Balance_M, Name, mphone as Details from " + dbUser + "regInfo where " + convert.ToPascalCase(criteria) + " like '%" + filter + "%'  and cat_Id='" + option + "' order by reg_date desc";
                        break;
                    }

                    var result = connection.Query(query);
                    this.CloseConnection(connection);
                    return(result);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }