Exemple #1
0
        public static GridEntity <T> GetGridData_No_Paging(string comname, string ProcName, string CallType, string parm1 = "", string parm2 = "", string parm3 = "", string parm4 = "", string parm5 = "", string parm6 = "", string parm7 = "", string parm8 = "", string parm9 = "", string parm10 = "")
        {
            try
            {
                dbConn = new SqlConnection(ConnectionString);
                dbConn.Open();
                cmd             = new SqlCommand(ProcName, dbConn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@ComC1", comname));
                cmd.Parameters.Add(new SqlParameter("@CallType", CallType));
                cmd.Parameters.Add(new SqlParameter("@Desc1", parm1));
                cmd.Parameters.Add(new SqlParameter("@Desc2", parm2));
                cmd.Parameters.Add(new SqlParameter("@Desc3", parm3));
                cmd.Parameters.Add(new SqlParameter("@Desc4", parm4));
                cmd.Parameters.Add(new SqlParameter("@Desc5", parm5));
                cmd.Parameters.Add(new SqlParameter("@Desc6", parm6));
                cmd.Parameters.Add(new SqlParameter("@Desc7", parm7));
                cmd.Parameters.Add(new SqlParameter("@Desc8", parm8));
                cmd.Parameters.Add(new SqlParameter("@Desc9", parm9));
                da = new SqlDataAdapter(cmd);
                ds = new DataSet();
                da.Fill(ds);
                dbConn.Close();

                dt         = ds.Tables[0];
                totalCount = Convert.ToInt32(ds.Tables[0].Rows.Count);
                var dataList = (List <T>)ListConversion.ConvertTo <T>(dt).ToList();
                var result   = new GridResult <T>().Data(dataList, totalCount);
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemple #2
0
        protected void btnExportExcel_Click(object sender, EventArgs e)
        {
            List <Entity.TemplateMaster> lst = new List <Entity.TemplateMaster>();
            var query = (from v in BAL.TemplateMastermgmt.GetTemplateMasterData(0, -1)
                         select new
            {
                v.TemplateDropdownName,
            }).ToList();

            ListConversion.ExporttoExcel(ListConversion.ToDataTable(query));
        }
        protected void btnExportExcel_Click(object sender, EventArgs e)
        {
            List <Entity.RegexMasterEntitycs> lst = new List <Entity.RegexMasterEntitycs>();
            var query = (from v in BAL.FormMastermgmt.GEtRegexMasterData(0)
                         select new
            {
                v.ValidationName,
            }).ToList();

            ListConversion.ExporttoExcel(ListConversion.ToDataTable(query));
        }
Exemple #4
0
            public static GridEntity <T> DataSourceWithDateQuary(GridOptions options, string query, string orderBy, string condition, string withDateQuary)
            {
                //string sql = "SELECT * FROM " + tableName;
                var _connection = new CommonConnection();

                try
                {
                    query = query.Replace(';', ' ');

                    string sqlQuery = options != null ? GridQueryBuilder <T> .Query(options, query, orderBy, condition) : query;

                    if (!string.IsNullOrEmpty(condition))
                    {
                        condition = " WHERE " + condition;
                    }

                    var condition1 = options != null ? GridQueryBuilder <T> .FilterCondition(options.filter) : "";

                    if (!string.IsNullOrEmpty(condition1))
                    {
                        if (!string.IsNullOrEmpty(condition))
                        {
                            condition += " And " + condition1;
                        }
                        else
                        {
                            condition = " WHERE " + condition1;
                        }
                    }

                    if (withDateQuary != "")
                    {
                        sqlQuery = withDateQuary + sqlQuery;
                    }

                    DataTable dataTable = _connection.GetDataTable(sqlQuery);

                    var sqlCount = withDateQuary + " SELECT COUNT(*) FROM (" + query + " ) As tbl " + condition;


                    int totalCount = Convert.ToInt32(_connection.ExecuteScalar(sqlCount));

                    var dataList = (List <T>)ListConversion.ConvertTo <T>(dataTable);
                    var result   = new GridResult <T>().Data(dataList, totalCount);

                    return(result);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
Exemple #5
0
        public User GetUserById(string username, string userPass, string terminalId)
        {
            var ds = new DataSet();
            var dt = new DataTable();

            ds = _common.select_data_10("", "SP_LOGIN_USER", "LOGON_USER", username, userPass, terminalId);

            dt = ds.Tables[0];

            var dataList = (List <User>)ListConversion.ConvertTo <User>(dt);

            return(dataList.SingleOrDefault());
        }
        protected void btnExportExcel_Click(object sender, EventArgs e)
        {
            List <Entity.FormMaster> lst = new List <Entity.FormMaster>();
            var query = (from v in BAL.FormMastermgmt.GetFormMasterData(0, -1)
                         select new
            {
                v.FormName,
                v.FormTitle,
                v.Remarks
            }).ToList();

            ListConversion.ExporttoExcel(ListConversion.ToDataTable(query));
        }
        public NoticeInfo SaveNoticeInfo(NoticeInfo objNotice, User user)
        {
            var lst = new NoticeInfo();

            try
            {
                DataTable dt =
                    Insert_Update("SP_INSERT_NOTICEINFO", "SAVE_NOTICE_DATA", objNotice, user);
                lst            = ListConversion.ConvertTo <NoticeInfo>(dt).SingleOrDefault();
                lst.SaveStatus = Operation.Success.ToString();
            }
            catch (Exception ex)
            {
                lst.SaveStatus = ex.Message;
            }
            return(lst);
        }
Exemple #8
0
        public static GridEntity <T> GetGridData_5(GridOptions gridOption, string ProcName, string CallType, string orderby, string param1 = "", string param2 = "", string param3 = "", string param4 = "", string param5 = "")
        {
            try
            {
                gridOption.take = gridOption.skip + gridOption.take;
                var filterby = "";
                if (gridOption.filter != null)
                {
                    filterby = gridOption != null ? GridQueryBuilder <T> .FilterCondition(gridOption.filter) : "";
                }
                var dir = "";
                if (gridOption.sort != null)
                {
                    dir = gridOption.sort[0].dir;
                }

                dbConn = new SqlConnection(ConnectionString);
                dbConn.Open();
                cmd             = new SqlCommand(ProcName, dbConn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@CallType", CallType));
                cmd.Parameters.Add(new SqlParameter("@skip", gridOption.skip));
                cmd.Parameters.Add(new SqlParameter("@take ", gridOption.take));
                cmd.Parameters.Add(new SqlParameter("@filter", filterby));
                cmd.Parameters.Add(new SqlParameter("@orderby", orderby.Trim() + " " + dir));
                cmd.Parameters.Add(new SqlParameter("@param1", param1));
                cmd.Parameters.Add(new SqlParameter("@param2", param2));
                cmd.Parameters.Add(new SqlParameter("@param3", param3));
                cmd.Parameters.Add(new SqlParameter("@param4", param4));
                cmd.Parameters.Add(new SqlParameter("@param5", param5));
                da = new SqlDataAdapter(cmd);
                ds = new DataSet();
                da.Fill(ds);
                dbConn.Close();

                dt         = ds.Tables[1];
                totalCount = Convert.ToInt32(ds.Tables[0].Rows[0]["TotalCount"]);
                var dataList = (List <T>)ListConversion.ConvertTo <T>(dt).ToList();
                var result   = new GridResult <T>().Data(dataList, totalCount);
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public List <PlanningDetails> GetAllGridData(string planId)
        {
            var res = new List <PlanningDetails>();
            var obj = new PlanningDetails();
            var ds  = new DataSet();

            ds = _planningInfoDataService.GetAllGridData(planId);
            if (ds != null)
            {
                obj.WarpingInfo = (List <PlanningInfoDetailsWp1>)ListConversion.ConvertTo <PlanningInfoDetailsWp1>(ds.Tables[0]);
                obj.DyeingInfo  = (List <PlanningInfoDetailsDye1>)ListConversion.ConvertTo <PlanningInfoDetailsDye1>(ds.Tables[1]);
                obj.WeavingInfo = (List <PlanningInfoDetailsWv1>)ListConversion.ConvertTo <PlanningInfoDetailsWv1>(ds.Tables[2]);
                res.Add(obj);
            }

            return(res);
        }
Exemple #10
0
        public static List <T> DataSource(string query)
        {
            var connection = new CommonConnection();

            try
            {
                DataTable dataTable = connection.GetDataTable(query);

                var objData = (List <T>)ListConversion.ConvertTo <T>(dataTable);
                return(objData);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }
        }
        protected void btnExportExcel_Click(object sender, EventArgs e)
        {
            List <Entity.ConfigurationHead> lst = new List <Entity.ConfigurationHead>();
            var query = (from v in BAL.ConfigurationHeadMastermgmt.GetConfigurationHeadData(0, -1)
                         select new
            {
                v.FormTitle,
                ConfigurationHeadName = v.ConfigurationHeadName,
                HeadNote = v.HeadNote,
                InputType = v.InputType,
                MinInputValue = v.MinInputValue,
                MaxInputValue = v.MaxInputValue,
                DisplayPreferenceNo = v.DisplayPreferenceNo,
                IsCompulsaryEntry = v.IsCompulsaryEntry,
                TemplateDropdownName = v.TemplateDropdownName,
                Remark = v.TemplateDropdownName
            }).ToList();

            ListConversion.ExporttoExcel(ListConversion.ToDataTable(query));
        }
        public List <T> Select_Data_List <T>(string procedureName, string callName, string parm1 = "", string parm2 = "", string parm3 = "", string parm4 = "", string parm5 = "", string parm6 = "", string parm7 = "", string parm8 = "", string parm9 = "", string parm10 = "")
        {
            try
            {
                dbConn = new SqlConnection(ConnectionString);
                dbConn.Open();

                cmd             = new SqlCommand(procedureName, dbConn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@CallType", callName));
                cmd.Parameters.Add(new SqlParameter("@Desc1", parm1));
                cmd.Parameters.Add(new SqlParameter("@Desc2", parm2));
                cmd.Parameters.Add(new SqlParameter("@Desc3", parm3));
                cmd.Parameters.Add(new SqlParameter("@Desc4", parm4));
                cmd.Parameters.Add(new SqlParameter("@Desc5", parm5));
                cmd.Parameters.Add(new SqlParameter("@Desc6", parm6));
                cmd.Parameters.Add(new SqlParameter("@Desc7", parm7));
                cmd.Parameters.Add(new SqlParameter("@Desc8", parm8));
                cmd.Parameters.Add(new SqlParameter("@Desc9", parm9));
                cmd.Parameters.Add(new SqlParameter("@Desc10", parm10));

                da = new SqlDataAdapter(cmd);
                ds = new DataSet();
                da.Fill(ds);
                dbConn.Close();

                dt = ds.Tables[0];
                var dataList = new List <T>();

                if (dt.Rows.Count > 0)
                {
                    dataList = (List <T>)ListConversion.ConvertTo <T>(dt);
                }

                return(dataList);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Exemple #13
0
            public static List <T> DataSource(string query)
            {
                var returnList = new List <T>();

                try
                {
                    CommonConnection connection = new CommonConnection();
                    DataTable        dataTable  = connection.GetDataTable(query);

                    var data = (List <T>)ListConversion.ConvertTo <T>(dataTable);
                    if (data != null)
                    {
                        return(data);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                return(returnList);
            }
        public List <TreeItem> GetEmployeeTreeResult()
        {
            var res         = _basicDataService.GetEmployeeTreeResult("Get_Employee_For_Tree_Company");
            var comListList = ListConversion.ConvertTo <TreeItem>(res);

            if (comListList.Count > 0)
            {
                for (int y = 0; y < comListList.Count; y++)
                {
                    res = _basicDataService.GetEmployeeTreeResult("Get_Employee_For_Tree_Unit", comListList[y].id.ToString());
                    var unitList = ListConversion.ConvertTo <TreeItem>(res);
                    if (unitList.Count > 0)
                    {
                        comListList[y].items = new List <TreeItem>();
                        for (int i = 0; i < unitList.Count; i++)
                        {
                            comListList[y].items.Add(unitList[i]);
                            res = _basicDataService.GetEmployeeTreeResult("Get_Employee_For_Tree_Department", unitList[i].id.ToString());
                            var deptList = ListConversion.ConvertTo <TreeItem>(res);
                            if (deptList.Count > 0)
                            {
                                comListList[y].items[i].items = new List <TreeItem>();
                                for (int j = 0; j < deptList.Count; j++)
                                {
                                    comListList[y].items[i].items.Add(deptList[j]);
                                    res = _basicDataService.GetEmployeeTreeResult("Get_Employee_For_Tree_Section", unitList[i].id.ToString(), deptList[j].id.ToString());
                                    var secList = ListConversion.ConvertTo <TreeItem>(res);
                                    if (secList.Count > 0)
                                    {
                                        comListList[y].items[i].items[j].items = new List <TreeItem>();
                                        for (int k = 0; k < secList.Count; k++)
                                        {
                                            comListList[y].items[i].items[j].items.Add(secList[k]);
                                            res = _basicDataService.GetEmployeeTreeResult("Get_Employee_For_Tree_Wing", unitList[i].id.ToString(), deptList[j].id.ToString(), secList[k].id.ToString());
                                            var wList = ListConversion.ConvertTo <TreeItem>(res);
                                            if (wList.Count > 0)
                                            {
                                                comListList[y].items[i].items[j].items[k].items = new List <TreeItem>();
                                                for (int l = 0; l < wList.Count; l++)
                                                {
                                                    comListList[y].items[i].items[j].items[k].items.Add(wList[l]);
                                                    res = _basicDataService.GetEmployeeTreeResult("Get_Employee_For_Tree_Team", unitList[i].id.ToString(), deptList[j].id.ToString(), secList[k].id.ToString(), wList[l].id.ToString());
                                                    var tList = ListConversion.ConvertTo <TreeItem>(res);
                                                    if (tList.Count > 0)
                                                    {
                                                        comListList[y].items[i].items[j].items[k].items[l].items = new List <TreeItem>();
                                                        for (int m = 0; m < tList.Count; m++)
                                                        {
                                                            comListList[y].items[i].items[j].items[k].items[l].items.Add(tList[m]);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(comListList.ToList());
        }