Ejemplo n.º 1
0
        public ActionResult Create_Expense()
        {
            try
            {
                ViewBag.emptype = Session["Role_Id"].ToString();
                DataSet ds = dblayer.Bind_DropDownList();

                List <SelectListItem> li = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "Select", Value = "0"
                    },
                };
                foreach (DataRow dr in ds.Tables[1].Rows)
                {
                    li.Add(new SelectListItem {
                        Text = @dr["project_name"].ToString(), Value = @dr["project_id"].ToString()
                    });
                }

                ViewBag.projectlist = li;

                List <SelectListItem> lii = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "Select", Value = "0"
                    },
                };
                foreach (DataRow dr in ds.Tables[3].Rows)
                {
                    lii.Add(new SelectListItem {
                        Text = @dr["transport_name"].ToString(), Value = @dr["transport_id"].ToString()
                    });
                }
                ViewBag.ByModule = lii;

                List <SelectListItem> expenseli = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "Select", Value = "0"
                    },
                };
                foreach (DataRow dr in ds.Tables[2].Rows)
                {
                    expenseli.Add(new SelectListItem {
                        Text = @dr["expense_type_name"].ToString(), Value = @dr["expense_type_id"].ToString()
                    });
                }
                ViewBag.expenseType = expenseli;
            }
            catch (Exception ex)
            {
            }
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult Create_Timesheet()
        {
            try
            {
                DataSet   ds = dblayer.Bind_DropDownList();
                DataTable dt = ds.Tables[0];

                DataRow[]             result = dt.Select("worktype_id <> 8");
                List <SelectListItem> lii    = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "Select", Value = "0"
                    },
                };
                foreach (DataRow dr in result)
                {
                    lii.Add(new SelectListItem {
                        Text = @dr["worktype_name"].ToString(), Value = @dr["worktype_id"].ToString()
                    });
                }
                ViewBag.worklist = lii;

                ViewBag.custtype = ds.Tables[4];
                List <SelectListItem> lst = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "Select", Value = "0"
                    },
                };
                foreach (DataRow dr in ViewBag.custtype.Rows)
                {
                    lst.Add(new SelectListItem {
                        Text = @dr["customer_name"].ToString(), Value = @dr["customer_id"].ToString()
                    });
                }
                ViewBag.Customerlist = lst;

                List <SelectListItem> li = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "Select", Value = "0"
                    },
                };

                ViewBag.projectlist = li;
            }

            catch (Exception e)
            {
            }

            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult Create_Project()
        {
            try
            {
                ds = dblayer.Bind_DropDownList();
                ViewBag.projtype = ds.Tables[8];
                List <SelectListItem> ProjectType_li = new List <SelectListItem>();
                foreach (DataRow dr in ViewBag.projtype.Rows)
                {
                    ProjectType_li.Add(new SelectListItem {
                        Text = dr["project_type"].ToString(), Value = dr["project_type_id"].ToString()
                    });
                }
                ViewBag.Project_type = ProjectType_li;


                ViewBag.deptt = ds.Tables[5];
                List <SelectListItem> dplist = new List <SelectListItem>();
                foreach (DataRow dr in ViewBag.deptt.Rows)
                {
                    dplist.Add(new SelectListItem {
                        Text = dr["department_name"].ToString(), Value = dr["department_id"].ToString()
                    });
                }
                ViewBag.dept  = dplist;
                ViewBag.custt = ds.Tables[4];
                List <SelectListItem> custlist = new List <SelectListItem>();
                foreach (DataRow dr in ViewBag.custt.Rows)
                {
                    custlist.Add(new SelectListItem {
                        Text = dr["customer_name"].ToString(), Value = dr["customer_id"].ToString()
                    });
                }
                ViewBag.cust = custlist;
                ViewBag.empp = ds.Tables[6];
                List <SelectListItem> emplist = new List <SelectListItem>();
                foreach (DataRow dr in ViewBag.empp.Rows)
                {
                    emplist.Add(new SelectListItem {
                        Text = dr["emp_name"].ToString(), Value = dr["emp_id"].ToString()
                    });
                }
                ViewBag.emp = emplist;

                return(View());
            }
            catch (Exception ex)
            {
            }
            return(View());
        }
Ejemplo n.º 4
0
        public List <SelectListItem> GetDropdownEmployee()
        {
            List <SelectListItem> countryli = new List <SelectListItem>();
            DataTable             dt        = dblayer.Bind_DropDownList().Tables[14];

            try
            {
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        countryli.Add(new SelectListItem
                        {
                            Text  = dr["EMP_NAME"].ToString(),
                            Value = dr["EMP_ID"].ToString()
                        });
                    }
                }
                countryli.Insert(0, new SelectListItem {
                    Text = "Select", Value = "0"
                });
            }
            catch (Exception)
            {
            }
            return(countryli);
        }