예제 #1
0
        public HttpResponseMessage Login(string mail, string password)
        {
            using (DMSEntities dbContext = new DMSEntities())
            {
                //return dbContext.devices.ToList();
                var user = dbContext.users.FirstOrDefault(e => e.Mail == mail && e.Password == password);
                HttpResponseMessage response;

                if (user != null)
                {
                    var userDto = new UserDto()
                    {
                        user_id    = user.user_id,
                        first_name = user.first_name,
                        last_name  = user.last_name,
                        role       = user.role,
                        location   = user.role,
                        username   = user.Username,
                        mail       = user.Mail,
                        password   = user.Password,
                    };



                    response = Request.CreateResponse(HttpStatusCode.OK, userDto);
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.BadRequest, "No matching data found.");
                }

                return(response);
            }
        }
예제 #2
0
        public HttpResponseMessage GetByName(string name)
        {
            using (DMSEntities dbContext = new DMSEntities())
            {
                //return dbContext.devices.ToList();
                var Device = from x in dbContext.devices
                             where (x.name == name)
                             select new DeviceDto()
                {
                    device_id    = x.device_id,
                    name         = x.name,
                    manufacturer = x.manufacturer,
                    model        = x.model,
                    OS           = x.OS,
                    OS_version   = x.OS_version,
                    CPU          = x.CPU,
                    RAM          = x.RAM
                };



                HttpResponseMessage response;
                response = Request.CreateResponse(HttpStatusCode.OK, Device);
                return(response);
            }
        }
예제 #3
0
        public async Task <IHttpActionResult> PostDevice(device device)
        {
            using (DMSEntities dbContext = new DMSEntities())
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                dbContext.devices.Add(device);
                await dbContext.SaveChangesAsync();

                // New code:
                // Load author name


                var dto = new DeviceDto()
                {
                    device_id    = device.device_id,
                    name         = device.name,
                    manufacturer = device.manufacturer,
                    model        = device.model,
                    OS           = device.OS,
                    OS_version   = device.OS_version,
                    CPU          = device.CPU,
                    RAM          = device.RAM
                };

                return(CreatedAtRoute("DefaultApi", new { id = device.device_id }, dto));
            }
        }
예제 #4
0
        public IHttpActionResult PostUser(UserDto user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid data."));
            }

            using (DMSEntities dbContext = new DMSEntities())
            {
                dbContext.users.Add(new user()
                {
                    //user_id = user.user_id,
                    first_name = user.first_name,
                    last_name  = user.last_name,
                    role       = user.role,
                    location   = user.role,
                    Username   = user.username,
                    Mail       = user.mail,
                    Password   = user.password,
                });



                dbContext.SaveChanges();
            }

            return(Ok());
        }
예제 #5
0
 public void CreateClient(Client client)
 {
     using (DMSEntities dmsEntities = this.dmsEntities){
         dmsEntities.Client.Add(client);
         dmsEntities.SaveChanges();
     }
 }
예제 #6
0
파일: DropdownList.cs 프로젝트: dpiriya/DMS
 public List<SelectListItem> TypeList()
 {
     using (DMSEntities dms = new DMSEntities())
     {
         List<SelectListItem> dlist = dms.tbl_trx_office.Select(em => new SelectListItem { Value = em.doc_type, Text = em.doc_type }).Distinct().ToList();
         return dlist;
     }
 }
예제 #7
0
파일: DropdownList.cs 프로젝트: dpiriya/DMS
 public List<SelectListItem> AtypeList()
 {
     using (DMSEntities dms = new DMSEntities())
     {
         List<SelectListItem> alist = dms.tbl_mst_dropdown.Where(m => m.ListName == "Agreement" && m.ListGroup == "Dean").Select(em => new SelectListItem { Value = em.ListItemValue, Text = em.ListItemText }).ToList();
         return alist;
     }
 }
예제 #8
0
파일: DropdownList.cs 프로젝트: dpiriya/DMS
 public List<SelectListItem> Dropdown()
 {
     using (DMSEntities dms = new DMSEntities())
     {
        List<SelectListItem> list = dms.tbl_mst_dropdown.OrderBy(m => m.ListItemText).Where(M => M.ListName == "Appointment").Select(m => new SelectListItem { Value = m.ListItemValue, Text = m.ListItemText }).ToList(); //(from listdb in tbl_mst_dropdown where ListName == 'Recruitment' orderby ListItemText);
         return list;
     }
 }
예제 #9
0
 public void CreateProductionType(ProductionType productionType)
 {
     using (DMSEntities dmsEntities = this.dmsEntities)
     {
         dmsEntities.ProductionType.Add(productionType);
         dmsEntities.SaveChanges();
     }
 }
예제 #10
0
        public void GetData_Recruit()
        {
            using (DMSEntities dms = new DMSEntities())
            {
                List <Recruit_trxModel> lists = dms.tbl_trx_recruitment.Select(m => new Recruit_trxModel()
                {
                    recruit_trx_id = m.recruit_trx_id, EmployeeID = m.EmployeeID, EmployeeName = m.EmployeeName, Appoint_mode = m.Appoint_mode, page_count = m.page_count, file_name = m.file_name, uploadedBy = m.uploadedBy, is_active = m.is_active, path = m.file_path + m.file_name
                }).ToList();

                JavaScriptSerializer jss = new JavaScriptSerializer();
                jss.MaxJsonLength = Int32.MaxValue;

                Context.Response.Write(jss.Serialize(lists));
            }
            //string cs = ConfigurationManager.ConnectionStrings["DMS"].ConnectionString;
            //List<Recruit_trxModel> lists = new List<Recruit_trxModel>();
            //using (SqlConnection con = new SqlConnection(cs))
            //{
            //    SqlCommand cmd = new SqlCommand("sp_search_recruit", con);
            //    cmd.Parameters.Add("@mode", SqlDbType.NVarChar, 20).Value = "LastUpdated";
            //    cmd.Parameters.Add("@dept", SqlDbType.NVarChar, 10).Value = "";
            //    cmd.Parameters.Add("@coor", SqlDbType.NVarChar, 50).Value = "";
            //    cmd.CommandType = CommandType.StoredProcedure;
            //    con.Open();
            //    SqlDataReader dr = cmd.ExecuteReader();
            //    while (dr.Read())
            //    {
            //        Recruit_trxModel list = new Recruit_trxModel();
            //        list.recruit_trx_id = Convert.ToInt32(dr["recruit_trx_id"]);
            //        list.EmployeeID = dr["EmployeeID"].ToString();
            //        list.EmployeeName = dr["EmployeeName"].ToString();
            //        list.Appoint_mode = dr["Appoint_mode"].ToString();
            //        list.file_name = dr["file_name"].ToString();
            //        list.file_path = dr["file_path"].ToString();
            //        list.page_count = Convert.ToInt32(dr["page_count"]);
            //        list.uploadedBy = dr["uploadedBy"].ToString();
            //        list.is_active = Convert.ToBoolean(dr["is_active"]);
            //        list.path = dr["path"].ToString();
            //        lists.Add(list);
            //    }
            //}
            //JavaScriptSerializer jss = new JavaScriptSerializer();
            //jss.MaxJsonLength = Int32.MaxValue;
            ////var result = new ContentResult
            ////{
            ////    Content = jss.Serialize(lists),
            ////    ContentType = "application/json"
            ////};
            //Context.Response.Write(jss.Serialize(lists));
            ////DMS_businessLayer dms_BussinessLayer = new DMS_businessLayer();
            ////string action = "LastUpdated";
            ////List<Recruit_trxModel> list = dms_BussinessLayer.UploadedView(action, "", "").ToList();
            ////JavaScriptSerializer jss = new JavaScriptSerializer();
            ////Context.Response.Write(jss.Serialize(list));
        }
예제 #11
0
 public List <SelectListItem> agreementList()
 {
     using (DMSEntities dms = new DMSEntities())
     {
         //List<SelectListItem> alist = dms.tbl_mst_dropdown.Where(m=>m.ListGroup=="Dean" && m.ListName=="Agreement").Select(m => new SelectListItem { Text = m.ListItemText, Value = m.ListItemValue }).ToList();
         List <SelectListItem> alist = dms.tbl_trx_dean.Select(m => new SelectListItem {
             Text = m.Agreement_type, Value = m.Agreement_type
         }).Distinct().ToList();
         return(alist);
     }
 }
예제 #12
0
        public IHttpActionResult Put(UserDto userDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (DMSEntities dbContext = new DMSEntities())
            {
                var existingUser = dbContext.users.Where(e => e.Mail == userDto.mail)
                                   .FirstOrDefault <user>();

                if (existingUser != null)
                {
                    if (userDto.last_name != null)
                    {
                        existingUser.last_name = userDto.last_name;
                    }
                    if (userDto.first_name != null)
                    {
                        existingUser.first_name = userDto.first_name;
                    }
                    if (userDto.role != null)
                    {
                        existingUser.role = userDto.role;
                    }
                    if (userDto.location != null)
                    {
                        existingUser.location = userDto.location;
                    }
                    if (userDto.username != null)
                    {
                        existingUser.Username = userDto.username;
                    }
                    if (userDto.mail != null)
                    {
                        existingUser.Mail = userDto.mail;
                    }
                    if (userDto.password != null)
                    {
                        existingUser.Password = userDto.password;
                    }

                    dbContext.SaveChanges();
                }
                else
                {
                    return(NotFound());
                }
            }

            return(Ok());
        }
예제 #13
0
        public IHttpActionResult Delete(string username)
        {
            if (username == null)
            {
                return(BadRequest("Not a valid student id"));
            }

            using (DMSEntities dbContext = new DMSEntities())
            {
                var student = dbContext.users
                              .Where(s => s.Username == username)
                              .FirstOrDefault();

                dbContext.Entry(student).State = System.Data.Entity.EntityState.Deleted;
                dbContext.SaveChanges();
            }

            return(Ok());
        }
예제 #14
0
        public void GetData_Purchase()
        {
            //string cs = ConfigurationManager.ConnectionStrings["DMS"].ConnectionString;
            //List<Purchase_trxModel> lists = new List<Purchase_trxModel>();
            //using (SqlConnection con = new SqlConnection(cs))
            //{
            //    SqlCommand cmd = new SqlCommand("sp_search_purchase", con);
            //    //cmd.Parameters.Add("@mode", SqlDbType.NVarChar, 20).Value = "LastUpdated";
            //    cmd.CommandType = CommandType.StoredProcedure;
            //    //cmd.Parameters.Add(new SqlParameter("@mode", "LastUploaded"));
            //    con.Open();
            //    SqlDataReader dr = cmd.ExecuteReader();
            //    while (dr.Read())
            //    {
            //        Purchase_trxModel list = new Purchase_trxModel();
            //        list.purchase_trx_id = Convert.ToInt32(dr["purchase_trx_id"]);
            //        list.indent_no = dr["indent_no"].ToString();
            //        list.project_no = dr["project_no"].ToString();
            //        list.project_coordinator = dr["project_coordinator"].ToString();
            //        list.file_path = dr["file_path"].ToString();
            //        list.file_namee = dr["file_namee"].ToString();
            //        list.page_count = Convert.ToInt32(dr["page_count"]);
            //        list.uploadedBy = dr["uploadedBy"].ToString();
            //        list.is_active = Convert.ToBoolean(dr["is_active"]);
            //        list.path = dr["path"].ToString();
            //        lists.Add(list);
            //    }

            //}
            using (DMSEntities dms = new DMSEntities())
            {
                List <Purchase_trxModel> lists = dms.tbl_trx_purchase.Select(m => new Purchase_trxModel()
                {
                    purchase_trx_id = m.purchase_trx_id, indent_no = m.indent_no, project_no = m.project_no, project_coordinator = m.project_coordinator, file_namee = m.file_namee, page_count = m.page_count, uploadedBy = m.uploadedBy, is_active = m.is_active, path = m.file_path + m.file_namee
                }).ToList();
                JavaScriptSerializer jss = new JavaScriptSerializer();
                jss.MaxJsonLength = Int32.MaxValue;
                Context.Response.Write(jss.Serialize(lists));
            }
        }
예제 #15
0
        public HttpResponseMessage Get()
        {
            using (DMSEntities dbContext = new DMSEntities())
            {
                //return dbContext.devices.ToList();
                var UserList = from x in dbContext.users
                               select new UserDto()
                {
                    user_id    = x.user_id,
                    first_name = x.first_name,
                    last_name  = x.last_name,
                    role       = x.role,
                    location   = x.role,
                    username   = x.Username,
                    mail       = x.Mail,
                    password   = x.Password,
                };

                HttpResponseMessage response;
                response = Request.CreateResponse(HttpStatusCode.OK, UserList.ToList());
                return(response);
            }
        }
예제 #16
0
 public void GetData_Accounts()
 {
     using (DMSEntities dms = new DMSEntities())
     {
         List <Accounts_trxModel> lists = dms.tbl_trx_accounts.Select(m => new Accounts_trxModel()
         {
             accounts_trx_id = m.accounts_trx_id, voucher_no = m.voucher_no, project_no = m.project_no, file_voucher = m.file_voucher, file_Namee = m.file_Namee, page_count = m.page_count, uploadedBy = m.uploadedBy, is_spon = m.is_spon, path = m.file_path + m.file_Namee
         }).ToList();
         JavaScriptSerializer jss = new JavaScriptSerializer();
         jss.MaxJsonLength = Int32.MaxValue;
         Context.Response.Write(jss.Serialize(lists));
     }
     //string cs = ConfigurationManager.ConnectionStrings["DMS"].ConnectionString;
     //List<Accounts_trxModel> lists = new List<Accounts_trxModel>();
     //using (SqlConnection con = new SqlConnection(cs))
     //{
     //    SqlCommand cmd = new SqlCommand("sp_search_accounts", con);
     //    cmd.CommandType = CommandType.StoredProcedure;
     //    con.Open();
     //    SqlDataReader dr = cmd.ExecuteReader();
     //    while (dr.Read())
     //    {
     //        Accounts_trxModel list = new Accounts_trxModel();
     //        list.accounts_trx_id = Convert.ToInt32(dr["accounts_trx_id"]);
     //        list.voucher_no = dr["voucher_no"].ToString();
     //        list.project_no = dr["project_no"].ToString();
     //        list.file_voucher = dr["file_voucher"].ToString();
     //        list.file_Namee = dr["file_Namee"].ToString();
     //        list.page_count = Convert.ToInt32(dr["page_count"]);
     //        list.uploadedBy = dr["uploadedBy"].ToString();
     //        list.is_active = Convert.ToBoolean(dr["is_active"]);
     //        list.path = dr["path"].ToString();
     //        lists.Add(list);
     //    }
     //}
 }
 public MailReceiverSettingRepository()
 {
     this._entities = new DMSEntities();
 }
예제 #18
0
 public ReceiveSerialNoDetailsRepository()
 {
     this._entities = new DMSEntities();
 }
예제 #19
0
 public InventoryAdjustmentRepository()
 {
     this._entities = new DMSEntities();
 }
예제 #20
0
 public OnlineInvoiceAndPaymentRepository()
 {
     _entities = new DMSEntities();
     this.partyJournalRepository = new PartyJournalRepository();
 }
예제 #21
0
 public OnlineReturnRepository()
 {
     _entities = new DMSEntities();
 }
 public WarehouseTypeRepository()
 {
     this._entities = new DMSEntities();
 }
예제 #23
0
 public SbuRepository()
 {
     this._entities = new DMSEntities();
 }
 public ProductVersionMappingRepository()
 {
     this._entities = new DMSEntities();
 }
 public DesignationRepository()
 {
     this._entities = new DMSEntities();
 }
예제 #26
0
 //contructor for DI
 public SimpleEntitiesManager(DMSEntities dmsEntities)
 {
     this.dmsEntities = dmsEntities;
 }
예제 #27
0
 public LocalPurchaseOrderRepository()
 {
     this._entities = new DMSEntities();
 }
 //contructor for DI
 public ProductionManager(DMSEntities dmsEntities)
 {
     this.dmsEntities = dmsEntities;
 }
예제 #29
0
 public SetupBranchProvider()
 {
     this._ent = new DMSEntities();
 }
예제 #30
0
 public UserRepository()
 {
     this._entities = new DMSEntities();
 }