Esempio n. 1
0
        public string GetToken(ClsReturnValues audience, int UserGroupID)
        {
            // TODO - Authenticate credentials here
            // TODO - Based on the audience passed in, pick the shared key from key store
            // Just hard-coding a key heress
            string key = "qqO5yXcbijtAdYmS2Otyzeze2XQedqy+Tp37wQ3sgTQ=";

            SimpleWebToken token = new SimpleWebToken(key)
            {
                Issuer = "tdoCloud"
            };

            //verify the user from the database
            token.AddClaim(ClaimTypes.Name, audience.ID.ToString());
            //token.AddClaim(ClaimTypes.Email, "*****@*****.**");
            using (tdoEntities db = new tdoEntities())
            {
                var groupName = db.uspGetUserGroups().ToList <ClsUserGroups>().Where(p => p.userGroupID == UserGroupID).First().groupName;
                token.AddClaim(ClaimTypes.Role, groupName);
                token.AddClaim("GroupID", UserGroupID.ToString());
            }

            //token.AddClaim(ClaimTypes.Role, "Administrator");
            return(token.ToString());
        }
Esempio n. 2
0
 public static ClsReturnValues delLocation(int locationID)
 {
     ClsReturnValues lst = new ClsReturnValues();
     using (var db = new tdoEntities())
     {
         lst = db.uspDelLocation(locationID).FirstOrDefault();
     }
     return lst;
 }
Esempio n. 3
0
 public static ClsReturnValues delMenuIcons(int menuIconID)
 {
     ClsReturnValues lst = new ClsReturnValues();
     using (var db = new tdoEntities())
     {
         lst = db.uspDelMenuIcons(menuIconID).FirstOrDefault();
     }
     return lst;
 }
Esempio n. 4
0
 public static List<ClsUserSessionHistory> getUserSessionHistory()
 {
     List<ClsUserSessionHistory> lst = new List<ClsUserSessionHistory>();
     try
     {
         using (var db = new tdoEntities()) { lst = db.uspGetUserSessionHistory().ToList<ClsUserSessionHistory>(); }
     }
     catch { } return lst;
 }
Esempio n. 5
0
 public static ClsReturnValues delCargoType(int cargoTypeID)
 {
     ClsReturnValues lst = new ClsReturnValues();
     using (var db = new tdoEntities())
     {
         lst = db.uspDelCargoType(cargoTypeID).FirstOrDefault();
     }
     return lst;
 }
Esempio n. 6
0
 public static ClsReturnValues delRegister(int tdoRegisterID)
 {
     ClsReturnValues lst = new ClsReturnValues();
     using (var db = new tdoEntities())
     {
         lst = db.uspDelRegister(tdoRegisterID).FirstOrDefault();
     }
     return lst;
 }
Esempio n. 7
0
 public static ClsJobNumber getJobNumber()
 {
     ClsJobNumber lst = new ClsJobNumber();
     using (var db = new tdoEntities())
     {
         lst = db.uspGetJobNumber().FirstOrDefault();
     }
     return lst;
 }
Esempio n. 8
0
 public static List<ClsRegister> getRegister(int registerID)
 {
     List<ClsRegister> lst = new List<ClsRegister>();
     using (var db = new tdoEntities())
     {
         lst = db.uspGetRegister(registerID).ToList<ClsRegister>();
     }
     return lst;
 }
Esempio n. 9
0
 public static ClsReturnValues delForms(int formID)
 {
     ClsReturnValues lst = new ClsReturnValues();
     using (var db = new tdoEntities())
     {
         lst = db.uspDelForms(formID).FirstOrDefault();
     }
     return lst;
 }
Esempio n. 10
0
 public static ClsReturnValues delActiveSessions(Guid sessionID, int userID)
 {
     ClsReturnValues lst = new ClsReturnValues();
     using (var db = new tdoEntities())
     {
         lst = db.uspDelUserSession(sessionID, userID).FirstOrDefault();
     }
     return lst;
 }
Esempio n. 11
0
        public JsonResult setRegister(string tdoRegisterID, string jobNumber, string dateReceived, string expiryDate, string status, string cargoTypeID, string fileRef,
                                      string destinationID, string terminalID, string containerNo, string returnTerminal, string truckID, string tdoReceiptDate, string schDelDate,
                                      string remarks, string createdByID, string sessionID)
        {
            List <ClsUserDisplay> userDisplay = new List <ClsUserDisplay>();

            using (tdoEntities db = new tdoEntities())
            {
                userDisplay = db.uspGetUserDisplay(GetID()).ToList <ClsUserDisplay>();
            }
            List <string> editableForms = Restriction.GetEditableForms(userDisplay);
            List <string> addableForms  = Restriction.GetAddableForms(userDisplay);

            if (int.Parse(tdoRegisterID) == 0 && !addableForms.Contains("Register"))
            {
                return(Json(new { id = 0, isSuccess = false, msg = "You are not allowed to add new records." }));
            }
            else if (int.Parse(tdoRegisterID) != 0 && !editableForms.Contains("Register"))
            {
                return(Json(new { id = 0, isSuccess = false, msg = "You are not allowed to edit records." }));
            }

            if (tdoRegisterID == "")
            {
                tdoRegisterID = "0";
            }

            Guid Session = new Guid(GetSession()); //do not hard code session ID and createdbyID
            int  _id     = 0;

            try { _id = int.Parse(tdoRegisterID.Trim()); }
            catch { }
            ClsRegister obj = new ClsRegister()
            {
                tdoRegisterID  = _id,
                jobNumber      = jobNumber,
                dateReceived   = StringToArray.ConvertToDate(dateReceived),
                expiryDate     = StringToArray.ConvertToDate(expiryDate),
                status         = status,
                cargoTypeID    = int.Parse(cargoTypeID),
                fileRef        = fileRef,
                destinationID  = int.Parse(destinationID),
                terminalID     = int.Parse(terminalID),
                containerNo    = containerNo,
                returnTerminal = int.Parse(returnTerminal),
                truckID        = int.Parse(truckID),
                tdoReceiptDate = StringToArray.ConvertToDate(tdoReceiptDate),
                schDelDate     = StringToArray.ConvertToDate(schDelDate),
                remarks        = remarks,
                createdByID    = GetID(),
                sessionID      = Session
            };
            ClsReturnValues k = Modules.setRegister(obj);

            return(Json(new { id = k.ID, isSuccess = k.IsSuccess ?? false ? 1 : 0, msg = k.Response }));
        }
Esempio n. 12
0
        public static List <ClsState> getState()
        {
            List <ClsState> lst = new List <ClsState>();

            using (var db = new tdoEntities())
            {
                lst = db.uspGetState().ToList <ClsState>();
            }
            return(lst);
        }
Esempio n. 13
0
        public static ClsReturnValues setPort(ClsPort obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditPort(obj.portID, obj.portName, obj.locationID, obj.createdByID, SessionID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 14
0
        public static List <ClsPort> getPort()
        {
            List <ClsPort> lst = new List <ClsPort>();

            using (var db = new tdoEntities())
            {
                lst = db.uspGetPort().ToList <ClsPort>();
            }
            return(lst);
        }
Esempio n. 15
0
        public static List <ClsDriver> getDriver()
        {
            List <ClsDriver> lst = new List <ClsDriver>();

            using (var db = new tdoEntities())
            {
                lst = db.uspGetDriver().ToList <ClsDriver>();
            }
            return(lst);
        }
Esempio n. 16
0
        public static ClsReturnValues delTruck(int truckID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspDelTruck(truckID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 17
0
        public static ClsReturnValues setCity(ClsCity obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditCity(obj.cityID, obj.cityName, obj.cityCode, obj.stateID, obj.createdByID, SessionID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 18
0
        public static ClsReturnValues setCargoType(ClsCargoType obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditCargoType(obj.cargoTypeID, obj.cargoTypeName, obj.createdByID, SessionID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 19
0
        public static ClsReturnValues setMenus(ClsMenus obj)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditMenus(obj.menuID, obj.menuName, obj.menuDesc, obj.createdByID, obj.menuRanking, obj.sessionID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 20
0
        public static ClsReturnValues setDriver(ClsDriver obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditDriver(obj.driverID, obj.driverCode, obj.firstName, obj.middleName, obj.lastName, obj.createdByID, SessionID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 21
0
        public static List <ClsTruck> getTruck()
        {
            List <ClsTruck> lst = new List <ClsTruck>();

            using (var db = new tdoEntities())
            {
                lst = db.uspGetTruck().ToList <ClsTruck>();
            }
            return(lst);
        }
Esempio n. 22
0
        public static ClsReturnValues delLocation(int locationID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspDelLocation(locationID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 23
0
        public static ClsReturnValues setUsersGroup(ClsUserGroups obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditUserGroups(obj.userGroupID, obj.groupName, obj.description ?? "", obj.createdByID, SessionID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 24
0
        public static List <ClsMenuIcons> getMenuIcons(int menuIconID)
        {
            List <ClsMenuIcons> lst = new List <ClsMenuIcons>();

            using (var db = new tdoEntities())
            {
                lst = db.uspGetMenuIcons(menuIconID).ToList <ClsMenuIcons>();
            }
            return(lst);
        }
Esempio n. 25
0
        public static ClsReturnValues setMenuIcons(ClsMenuIcons obj)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditMenuIcons(obj.menuIconID, obj.menuID, obj.menuIconName).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 26
0
        public static ClsReturnValues setForms(ClsForms obj)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditForms(obj.formID, obj.menuItemID, obj.formName, obj.formDescription, obj.createdByID, obj.sessionID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 27
0
        public static ClsReturnValues delMenuIcons(int menuIconID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspDelMenuIcons(menuIconID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 28
0
        public static List <ClsForms> getForms(int formID)
        {
            List <ClsForms> lst = new List <ClsForms>();

            using (var db = new tdoEntities())
            {
                lst = db.uspGetForms(formID).ToList <ClsForms>();
            }
            return(lst);
        }
Esempio n. 29
0
        public static List <ClsUsers> getUsers()
        {
            List <ClsUsers> lst = new List <ClsUsers>();

            using (var db = new tdoEntities())
            {
                lst = db.uspGetUsers().ToList <ClsUsers>();
            }
            return(lst);
        }
Esempio n. 30
0
        public static ClsReturnValues delUsers(int userID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspDelUsers(userID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 31
0
        public static List <ClsCity> getCity()
        {
            List <ClsCity> lst = new List <ClsCity>();

            using (var db = new tdoEntities())
            {
                lst = db.uspGetCity(0).ToList <ClsCity>();
            }
            return(lst);
        }
Esempio n. 32
0
        public static ClsReturnValues delCargoType(int cargoTypeID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspDelCargoType(cargoTypeID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 33
0
        public static List <ClsLocation> getLocation()
        {
            List <ClsLocation> lst = new List <ClsLocation>();

            using (var db = new tdoEntities())
            {
                lst = db.uspGetLocation().ToList <ClsLocation>();
            }
            return(lst);
        }
Esempio n. 34
0
        public static ClsReturnValues setAccessLevel(ClsAccessLevels obj)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditAccessLevels(obj.accessLevelID, obj.userGroupID, obj.formID, obj.canAdd, obj.canView, obj.canEdit, obj.canDelete, obj.canApprove, obj.createdByID, obj.sessionID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 35
0
        public static ClsReturnValues setTruck(ClsTruck obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditTruck(obj.truckID, obj.truckName, obj.regNumb, obj.truckTypeID, obj.createdByID, SessionID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 36
0
        public static ClsReturnValues setRegion(ClsRegion obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditRegion(obj.regionID, obj.regionName, obj.createdByID, SessionID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 37
0
        public static List <ClsTerminal> getTerminal()
        {
            List <ClsTerminal> lst = new List <ClsTerminal>();

            using (var db = new tdoEntities())
            {
                lst = db.uspGetTerminal().ToList <ClsTerminal>();
            }
            return(lst);
        }
Esempio n. 38
0
        public static List <ClsAccessLevels> getAccessLevel(int accessLevelID, int userGroupID, int formID)
        {
            List <ClsAccessLevels> lst = new List <ClsAccessLevels>();

            using (var db = new tdoEntities())
            {
                lst = db.uspGetAccessLevels(accessLevelID, userGroupID, formID).ToList <ClsAccessLevels>();
            }
            return(lst);
        }
Esempio n. 39
0
        public static ClsReturnValues setTerminal(ClsTerminal obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {
                lst = db.uspAddEditTerminal(obj.terminalID, obj.terminalName, obj.portID, obj.createdByID, SessionID).FirstOrDefault();
            }
            return(lst);
        }
Esempio n. 40
0
 public static ClsReturnValues changePassword(int userID, string oldPassword, string newPassword)
 {
     newPassword = Security.Encrypt(newPassword);
     oldPassword = Security.Encrypt(oldPassword);
     ClsReturnValues lst = new ClsReturnValues();
     using (var db = new tdoEntities())
     {
         lst = db.uspChangePassword(userID, oldPassword, newPassword).FirstOrDefault();
     }
     return lst;
 }
Esempio n. 41
0
        public static ClsReturnValues setRegister(ClsRegister obj)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditRegister(obj.tdoRegisterID,obj.jobNumber,obj.dateReceived,obj.expiryDate,obj.status,obj.cargoTypeID,obj.fileRef,obj.destinationID,
                                            obj.terminalID,obj.containerNo,obj.returnTerminal,obj.truckID,obj.tdoReceiptDate,obj.schDelDate,obj.loadingTime,obj.dispatchTime,
                                            obj.remarks,obj.createdByID,obj.sessionID).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 42
0
 public static ClsReturnValues setCargoType(ClsCargoType item)
 {
     ClsReturnValues obj = new ClsReturnValues();
     try
     {
         using (var db = new tdoEntities())
         {
             obj = db.uspAddEditCargoType(item.cargoTypeID, item.cargoTypeName,item.createdByID,item.sessionID).FirstOrDefault();
         }
     }
     catch (Exception ex) { obj.Response = ex.Message; obj.IsSuccess = false; obj.ID = 0; }
     return obj;
 }
Esempio n. 43
0
        public JsonResult deleteRegister(string ids)
        {
            List<ClsUserDisplay> userDisplay = new List<ClsUserDisplay>();
            using (tdoEntities db = new tdoEntities())
            {
                userDisplay = db.uspGetUserDisplay(GetID()).ToList<ClsUserDisplay>();
            }
            List<string> deleteableForms = Restriction.GetDeletableForms(userDisplay);

            if (!deleteableForms.Contains("Register"))
            {
                return Json(new { id = 0, isSuccess = false, msg = "You are not allowed to delete records here" });
            }

            string[] id_s = ids.Trim().Split(',');
            string message = "";
            List<ClsReturnValues> obj = new List<ClsReturnValues>();
            foreach (var id in id_s)
            {
                int _id = 0; try { _id = int.Parse(id.Trim()); }
                catch { }
                if (_id > 0)
                    obj.Add(Modules.delRegister(_id));
            }

            bool isSuccess = obj.Count(p => p.IsSuccess == false) > 0 ? false : true;
            if (obj.Count(p => p.IsSuccess == true) > 1)
            {
                message = obj.Count(p => p.IsSuccess == true).ToString() + " records deleted";
            }
            else
            {
                message = obj.Count(p => p.IsSuccess == true).ToString() + " record deleted";
            }

            return Json(new { id = isSuccess ? 1 : 0, isSuccess = isSuccess ? 1 : 0, msg = message });
        }
Esempio n. 44
0
 public static List<ClsTruckType> getTruckType()
 {
     List<ClsTruckType> lst = new List<ClsTruckType>();
     using (var db = new tdoEntities())
     {
         lst = db.uspGetTruckType().ToList<ClsTruckType>();
     }
     return lst;
 }
Esempio n. 45
0
 public static List<ClsTerminal> getTerminal()
 {
     List<ClsTerminal> lst = new List<ClsTerminal>();
     using (var db = new tdoEntities())
     {
         lst = db.uspGetTerminal().ToList<ClsTerminal>();
     }
     return lst;
 }
Esempio n. 46
0
        public static ClsReturnValues setRegion(ClsRegion obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditRegion(obj.regionID, obj.regionName, obj.createdByID, SessionID).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 47
0
        public static ClsReturnValues setPort(ClsPort obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditPort(obj.portID, obj.portName, obj.locationID, obj.createdByID, SessionID).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 48
0
        public static ClsReturnValues setTruckType(ClsTruckType obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditTruckType(obj.truckTypeID, obj.truckTypeName, obj.createdByID, SessionID).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 49
0
        public static ClsReturnValues setTerminal(ClsTerminal obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditTerminal(obj.terminalID, obj.terminalName, obj.portID, obj.createdByID, SessionID).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 50
0
        public static ClsReturnValues setUsersGroup(ClsUserGroups obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditUserGroups(obj.userGroupID, obj.groupName, obj.description ?? "", obj.createdByID, SessionID).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 51
0
        public static ClsReturnValues setUsers(ClsUsers obj)
        {
            //password encryption happens here
            obj.password = Security.Encrypt(obj.password);

            ClsReturnValues lst = new ClsReturnValues();
            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditUsers(obj.userID, obj.userGroupID, obj.userName, obj.password, obj.password, obj.passwordCanExpire, obj.passwordExpiryDate, obj.isLocked, obj.loginAttempts, obj.lastLoginDate, obj.theme, obj.resetPassword, obj.createdByID, obj.sessionID).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 52
0
        public static ClsReturnValues setCity(ClsCity obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditCity(obj.cityID, obj.cityName, obj.cityCode, obj.stateID, obj.createdByID, SessionID).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 53
0
        public static ClsReturnValues setAccessLevel(ClsAccessLevels obj)
        {
            ClsReturnValues lst = new ClsReturnValues();
            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditAccessLevels(obj.accessLevelID,obj.userGroupID,obj.formID,obj.canAdd,obj.canView,obj.canEdit,obj.canDelete,obj.canApprove,obj.createdByID,obj.sessionID).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 54
0
 public static ClsReturnValues resetPassword(int userID, string newPassword)
 {
     newPassword = Security.Encrypt(newPassword);
     ClsUsers U = Administration.getUsers().Where(p => p.userID == userID).ToList().FirstOrDefault();
     string oldPassword = U.password;
     ClsReturnValues lst = new ClsReturnValues();
     using (var db = new tdoEntities())
     {
         lst = db.uspChangePassword(userID, oldPassword, newPassword).FirstOrDefault();
     }
     return lst;
 }
Esempio n. 55
0
 //[PrincipalPermission(SecurityAction.Demand, Role = "Admin")]
 public static List<ClsUserGroups> getUsersGroup()
 {
     List<ClsUserGroups> lst = new List<ClsUserGroups>();
     using (var db = new tdoEntities())
     {
         lst = db.uspGetUserGroups().ToList<ClsUserGroups>();
     }
     return lst;
 }
Esempio n. 56
0
        public static ClsReturnValues setMenus(ClsMenus obj)
        {
            ClsReturnValues lst = new ClsReturnValues();
            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditMenus(obj.menuID,obj.menuName,obj.menuDesc, obj.createdByID,obj.menuRanking, obj.sessionID).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 57
0
        public static ClsReturnValues setForms(ClsForms obj)
        {
            ClsReturnValues lst = new ClsReturnValues();
            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditForms(obj.formID,obj.menuItemID,obj.formName,obj.formDescription,obj.createdByID, obj.sessionID).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 58
0
        public static ClsReturnValues setMenuIcons(ClsMenuIcons obj)
        {
            ClsReturnValues lst = new ClsReturnValues();
            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditMenuIcons(obj.menuIconID, obj.menuID, obj.menuIconName).FirstOrDefault();
            }
            return lst;
        }
Esempio n. 59
0
        public static List<ClsUploadRegister> getRegisterFromExcel(string fileName, int userID, Guid session)
        {
            List<ClsUploadRegister> lstRegister = new List<ClsUploadRegister>();
            List<ClsUploadRegister> lstResponse = new List<ClsUploadRegister>();
            List<ClsUploadRegister> lst = new List<ClsUploadRegister>();
            try
            {
                DataTable resultTable = GetExcelData(fileName);   //DataTable resultTable = GetCsvData(fileName);
                foreach (DataRow dr in resultTable.Rows)
                {
                    try
                    {
                        double dateR = double.Parse(dr[1].ToString().Trim());
                        var _dateR = DateTime.Parse(DateTime.FromOADate(dateR).ToString("yyyy-MM-dd hh:ss"));
                        double expDate = double.Parse(dr[2].ToString().Trim());
                        var _expDate = DateTime.Parse(DateTime.FromOADate(expDate).ToString("yyyy-MM-dd hh:ss"));
                        double tRDate = double.Parse(dr[11].ToString().Trim());
                        var _tRDate = DateTime.Parse(DateTime.FromOADate(tRDate).ToString("yyyy-MM-dd hh:ss"));
                        double sdDate = double.Parse(dr[12].ToString().Trim());
                        var _sdDate = DateTime.Parse(DateTime.FromOADate(sdDate).ToString("yyyy-MM-dd hh:ss"));
                        double dpTime = double.Parse(dr[13].ToString().Trim());
                        var _dpTime = DateTime.Parse(DateTime.FromOADate(dpTime).ToString("yyyy-MM-dd hh:ss"));
                        double ldTime = double.Parse(dr[14].ToString().Trim());
                        var _ldTime = DateTime.Parse(DateTime.FromOADate(ldTime).ToString("yyyy-MM-dd hh:ss"));

                        lstRegister.Add(new ClsUploadRegister()
                        {
                            jobNumber = dr[0].ToString().Trim(),
                            dateReceived = _dateR,
                            expiryDate = _expDate,
                            status = dr[3].ToString().Trim(),
                            cargoType = dr[4].ToString().Trim(),
                            fileRef = dr[5].ToString().Trim(),
                            terminal = dr[6].ToString().Trim(),
                            destination = dr[7].ToString().Trim(),
                            containerNo = dr[8].ToString().Trim(),
                            returnTerminal = dr[9].ToString().Trim(),
                            truck = dr[10].ToString().Trim(),
                            tdoReceiptDate = _tRDate,
                            schDelDate = _sdDate,
                            dispatchTime = _dpTime,
                            loadingTime = _ldTime,
                            remarks = dr[15].ToString().Trim(),
                            response = ""
                        });
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }

                foreach (var item in lstRegister)
                {
                    try
                    {
                        using (var db = new tdoEntities())
                        {
                            lst = db.uspUploadRegister(item.jobNumber, item.dateReceived, item.expiryDate, item.status, item.cargoType, item.fileRef,
                                            item.destination, item.terminal,item.containerNo, item.returnTerminal, item.truck, item.tdoReceiptDate,
                                            item.schDelDate, item.loadingTime, item.dispatchTime, item.remarks, userID, session).ToList<ClsUploadRegister>();
                        }
                        foreach (var dt in lst)
                        {
                            lstResponse.Add(new ClsUploadRegister()
                            {
                                jobNumber = dt.jobNumber,
                                dateReceived = dt.dateReceived,
                                expiryDate = dt.expiryDate,
                                status = dt.status,
                                cargoType = dt.cargoType,
                                fileRef = dt.fileRef,
                                destination = dt.destination,
                                terminal = dt.terminal,
                                containerNo = dt.containerNo,
                                returnTerminal = dt.returnTerminal,
                                truck = dt.truck,
                                tdoReceiptDate = dt.tdoReceiptDate,
                                schDelDate = dt.schDelDate,
                                loadingTime = dt.loadingTime,
                                dispatchTime = dt.dispatchTime,
                                remarks = dt.remarks,
                                isSuccess = dt.isSuccess,
                                response = dt.response
                            });
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return lstResponse;
        }
Esempio n. 60
0
        public static ClsReturnValues setDriver(ClsDriver obj, Guid SessionID)
        {
            ClsReturnValues lst = new ClsReturnValues();

            using (var db = new tdoEntities())
            {

                lst = db.uspAddEditDriver(obj.driverID, obj.driverCode, obj.firstName, obj.middleName, obj.lastName, obj.createdByID, SessionID).FirstOrDefault();
            }
            return lst;
        }