コード例 #1
0
        //添加对象事件处理
        //例如MonProject、MonGroup之类,
        //添加Tree,添加Obj
        //返回tree,返回Obj,更新
        public async void DGObjectListener(object sender, DGObject model)
        {
            if (menuItem.Tag.ToString() == "Common")
            {
                TreeDefinition def = await CommonRepo.AddProjectTree(Globals.project.projectID, _domain, menuBase.TargetObjType, model.ID, 0);

                _treeDefinitions.Add(def);
            }
            else
            {
                TreeDefinition item = DomainTreeView.SelectedItem as TreeDefinition;
                TreeDefinition def  = await CommonRepo.AddProjectTree(Globals.project.projectID, _domain, menuBase.TargetObjType, model.ID, item.ID);

                if (item.Chillds == null)
                {
                    item.Chillds = new ObservableCollection <TreeDefinition>();
                }
                item.Chillds.Add(def);
            }
            Domain domain = Globals.project.getDomain(_domain);

            domain.objectsDefinitions = await CommonRepo.GetObjectsDefinition(Globals.project.projectID, domain.name);

            domain.DGObjectsList = new List <DGObjects>();
            foreach (ObjectsDefinition definition in domain.objectsDefinitions)
            {
                domain.DGObjectsList.Add(new DGObjects()
                {
                    parent = domain, definition = definition,
                });
            }
            commonPropertyWin.DGObjectHandler -= DGObjectListener;
            commonPropertyWin.Close();
        }
コード例 #2
0
        //登陆验证
        private async void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            ServiceConfig.IP      = txtBoxIP.Text.ToString();
            ServiceConfig.PortNum = txtBoxPort.Text.ToString();

            ResultData resultData = await CommonRepo.GetLoginResult(txtBoxName.Text, txtBoxName2.Text);

            Runtime.Username      = txtBoxName.Text;
            Runtime.Password      = txtBoxName2.Text;
            Runtime.filtercontent = "Account or Password is wrong!";
            foreach (Useraccount _account in userloader.Users)
            {
                if ((_account.Username == Runtime.Username) && (_account.Password == Runtime.Password))
                {
                    Runtime.filtercontent = _account.filtercontent;
                }
            }
            if (Runtime.filtercontent == "Account or Password is wrong!")
            {
                MessageBox.Show(Runtime.filtercontent);
                return;
            }
            if (UserLoginFinished != null)
            {
                DoLoadTask();
                UserLoginFinished(this, null);
            }
        }
コード例 #3
0
        public HttpResponseMessage Login(User user)
        {
            HttpResponseMessage response = null;

            try
            {
                user.password = EncryptPassword.CalculateHash(user.password);
                Dictionary <string, object> resultSet = new Dictionary <string, object>();
                if (!CommonRepo.Login(user))
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_301", "Invalid Username or Password", "Invalid Username or Password"));
                }
                else
                {
                    int           user_id  = CommonRepo.GetUserID(user);
                    Role          role     = CommonRepo.GetUserRole(user_id);
                    EmployeeModel employee = EmployeeRepo.GetEmployeeDetailsByUserId(user_id);
                    resultSet.Add("employee_id", employee.id);
                    resultSet.Add("user_id", user_id);
                    resultSet.Add("UserName", employee.first_name + employee.last_name);
                    resultSet.Add("role_name", role.role_name);
                    resultSet.Add("role_id", role.id);
                    resultSet.Add("gender", employee.gender);
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", resultSet));
                }
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                Debug.WriteLine(exception.GetBaseException());
                response = Request.CreateResponse(HttpStatusCode.OK, exception.Message);
            }
            return(response);
        }
コード例 #4
0
        private async Task DownloadfileAsync()
        {

            if (!Directory.Exists(destnationfolder))
            {
                System.IO.Directory.CreateDirectory(destnationfolder);
                
            }

            filenames = new List<string>();
            
            string url = ServiceConfig.BaseURL + string.Format(ServiceConfig.filenamelistFormat, "YN", "ACHE", "46");
            filenames = await CommonRepo.Getappendixnames(url);
            foreach (string filename in filenames)
            {
                string completename = destnationfolder + "\\" + filename;
                if (File.Exists(completename))
                {
                    continue;
                }
                string result = await FileService.DownLoad(destnationfolder, "YN", filename);

            }
            if (filenames.Count == 0)
            {
                System.Windows.Forms.MessageBox.Show("无相关附件!");
                return;
            }
            Process.Start(destnationfolder);
            System.Windows.Forms.MessageBox.Show("已为您打开附件文件夹!");
            return;
        }
コード例 #5
0
        public async Task Init()
        {
            //获取domain对应的资源树
            List <TreeDefinition> treeList = await CommonRepo.GetProjectTree(Globals.project.projectID, _domain);

            _treeDefinitions           = new ObservableCollection <TreeDefinition>(treeList);
            DomainTreeView.ItemsSource = _treeDefinitions;
        }
コード例 #6
0
        private async void Savebtn_Click(object sender, RoutedEventArgs e)
        {
            _dataSourceInfo.DSType = sourceTypeCB.SelectedIndex + 1;
            DataSourceInfo model = await CommonRepo.PostDataSourceInfo(_dataSourceInfo);

            if (DataSourceInfoEventHandler != null)
            {
                DataSourceInfoEventHandler(this, model);
            }
            this.Close();
        }
コード例 #7
0
        public async void Downloadfile(object sender, RoutedEventArgs e)
        {
            filenames = new List <string>();
            string url = ServiceConfig.BaseURL + string.Format(ServiceConfig.filenamelistFormat, "YN", objectname, objectid.ToString());

            filenames = await CommonRepo.Getappendixnames(url);

            DownloadList downloadfilewindow = new DownloadList(this);

            downloadfilewindow.Show();

            //await DownloadfileAsync();
        }
コード例 #8
0
        public async Task LoadProjectList()
        {
            List <ProjectList> _projectLists;

            _projectLists = await CommonRepo.GetProjectList();

            projectLists = new List <ProjectList>();
            projectLists.Add(_projectLists.Find(x => x.CODE.Equals("YN")));
            projectBox.ItemsSource = projectLists;
            gLayer = Map.Layers["ProjectGraphicsLayer"] as GraphicsLayer;
            gLayer.Graphics.Clear();
            AddProjectsToMap(gLayer);
        }
コード例 #9
0
    void Start()
    {
        mainCamera       = Camera.main;
        animator         = GetComponent <Animator>();
        playerController = GetComponent <CharacterController>();
        commonRepo       = CommonRepo.instance;

        //Set Animator Hashes
        leftFootUpHash                = Animator.StringToHash(StaticStrings.RightFootUp);
        rightFootUpHash               = Animator.StringToHash(StaticStrings.LeftFootUp);
        directionHash                 = Animator.StringToHash(StaticStrings.Direction);
        angleHash                     = Animator.StringToHash(StaticStrings.Angle);
        speedHash                     = Animator.StringToHash(StaticStrings.Speed);
        rawSpeedHash                  = Animator.StringToHash(StaticStrings.RawSpeed);
        sprintFactorHash              = Animator.StringToHash(StaticStrings.SprintFactor);
        groundedFootHash              = Animator.StringToHash(StaticStrings.GroundedFoot);
        floorAngleHash                = Animator.StringToHash(StaticStrings.FloorAngle);
        isGroundedHash                = Animator.StringToHash(StaticStrings.IsGrounded);
        isFreeHash                    = Animator.StringToHash(StaticStrings.IsFree);
        isCrouchedHash                = Animator.StringToHash(StaticStrings.IsCrouched);
        fallDistanceHash              = Animator.StringToHash(StaticStrings.FallDistance);
        freeHash                      = Animator.StringToHash(StaticStrings.Free);
        starfeHash                    = Animator.StringToHash(StaticStrings.Starfe);
        crouchHash                    = Animator.StringToHash(StaticStrings.Crouch);
        standHash                     = Animator.StringToHash(StaticStrings.Stand);
        rightHash                     = Animator.StringToHash(StaticStrings.Right);
        forwardHash                   = Animator.StringToHash(StaticStrings.Forward);
        turnBlendPathHash             = Animator.StringToHash(StaticStrings.TurnBlendFullPath);
        crouchLocomotionPathHash      = Animator.StringToHash(StaticStrings.CrouchLocomotionFullPath);
        crouchStarfeTurnBlendPathHash = Animator.StringToHash(StaticStrings.CrouchStarfeTurnBlendFullPath);

        onGameStateChange.AddListener(OnGameStateChange);

        //Lock Cursor
        Cursor.lockState = CursorLockMode.Locked;
    }
コード例 #10
0
        public HttpResponseMessage ForgotPassword(ChangePasswordModel forgotpassword)
        {
            HttpResponseMessage response = null;

            try
            {
                Employee employee = EmployeeRepo.GetEmployeeById(forgotpassword.employee_id);
                User     user     = CommonRepo.GetuserById(employee.user_id);
                if (user.is_active == 1)
                {
                    if (forgotpassword.new_password == forgotpassword.confirm_password)
                    {
                        user.password = EncryptPassword.CalculateHash(forgotpassword.new_password);
                        CommonRepo.EditUserDetails(user);
                        string user_name = employee.first_name + " " + employee.last_name;
                        MailHandler.ChangePasswordIntimation(user_name, employee.email);
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "your password has been changed successfully", "your password has been changed successfully"));
                    }
                    else
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_302", "New Password and Confirm Password should be same", "New Password and Confirm Password should be same"));
                    }
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_303", "Access Denied", "Access Denied"));
                }
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                Debug.WriteLine(exception.GetBaseException());
                response = Request.CreateResponse(HttpStatusCode.OK, exception.Message);
            }
            return(response);
        }
コード例 #11
0
 public CommonBuss(CommonRepo _repo)
 {
     repo = _repo;
 }
コード例 #12
0
        public async Task LoadProject(string definitionFile)
        {
            try
            {
                if (definitionFile == null ||
                    definitionFile.Length == 0)
                {
                    return;
                }
                _prj = new Project()
                {
                    projectID = projectID
                };
                _prj.projectInfo = await CommonRepo.GetProjectInfo(_prj.projectID);

                _prj.domains = await CommonRepo.GetDomains(_prj.projectID);

                _prj.emaps = await CommonRepo.GetEMaps(_prj.projectID);

                Globals.project = _prj;
                foreach (Domain domain in _prj.domains)
                {
                    try
                    {
                        domain.objectsDefinitions = await CommonRepo.GetObjectsDefinition(_prj.projectID, domain.name);

                        domain.DGObjectsList = new List <DGObjects>();
                        foreach (ObjectsDefinition definition in domain.objectsDefinitions)
                        {
                            if ((definition.Layer3DName == null) || (definition.Layer3DName == ""))
                            {
                                definition.Layer3DName = definition.Domain + "/" + definition.Type;
                            }
                            DGObjects objs = new DGObjects()
                            {
                                parent = domain, definition = definition,
                            };
                            domain.DGObjectsList.Add(objs);
                            objs.objContainer = await RepositoryForClient.RetrieveObjs(objs);

                            _prj.objsDefIndex[definition.Name] = objs;
                        }
                    }
                    catch (Exception ex)
                    {
                        //  MessageBox.Show(ex.ToString());
                    }
                }

                loadDomainPanels();
                await LoadViews();


                if (projectLoaded != null)
                {
                    projectLoaded(this, EventArgs.Empty);
                }

                ViewHolder.SelectedIndex = 1;
            }
            catch (Exception ex)
            {
            }
        }
コード例 #13
0
        public async Task <HttpResponseMessage> UpdateEmployeeLeaveBalance()
        {
            // Check if the request contains multipart/form-data.
            if (!Request.Content.IsMimeMultipartContent())
            {
                throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
            }

            string root     = HttpContext.Current.Server.MapPath("~/App_Data");
            var    provider = new MultipartFormDataStreamProvider(root);

            DataSet          ds      = new DataSet();
            DataSet          ospDS   = new DataSet();
            SqlConnection    con     = null;
            OleDbDataAdapter oda     = null;
            SqlBulkCopy      objbulk = null;

            try
            {
                // Read the form data.
                await Request.Content.ReadAsMultipartAsync(provider);

                // This illustrates how to get the file names.
                foreach (MultipartFileData file in provider.FileData)
                {
                    Trace.WriteLine(file.Headers.ContentDisposition.FileName);
                    Trace.WriteLine("Server file path: " + file.LocalFileName);
                }
                MultipartFileData fileData = provider.FileData.First();
                string            fileName = fileData.Headers.ContentDisposition.FileName;

                if (fileName.StartsWith("\"") && fileName.EndsWith("\""))
                {
                    fileName = fileName.Trim('"');
                }

                string destinationFileName = fileName + Guid.NewGuid().ToString() + Path.GetExtension(fileName.Replace(" ", "_"));
                //string destinationFileName = fileName;
                // Use the Path.Combine method to safely append the file name to the path.
                // Will not overwrite if the destination file already exists.
                File.Move(fileData.LocalFileName, Path.Combine(HttpContext.Current.Server.MapPath("~/App_Data/Uploads/"), destinationFileName));
                File.Delete(fileData.LocalFileName);

                string fileExtension = Path.GetExtension(destinationFileName);
                string fileLocation  = HttpContext.Current.Server.MapPath("~/App_Data/Uploads/") + destinationFileName;

                if (fileExtension == ".xls" || fileExtension == ".xlsx")
                {
                    string excelConnectionString = string.Empty;
                    excelConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
                    //connection String for xls file format.
                    if (fileExtension == ".xls")
                    {
                        excelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
                    }
                    //connection String for xlsx file format.
                    else if (fileExtension == ".xlsx")
                    {
                        excelConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
                    }
                    //Create Connection to Excel work book and add oledb namespace
                    OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
                    excelConnection.Open();
                    string[] sheets = Utility.GetSheet.GetSheetName(excelConnection);
                    bool     flag   = false;
                    if (sheets.Length == 0)
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_304", "No Sheets available in the excel file", "No Sheets available in the excel file")));
                    }
                    else
                    {
                        string query = string.Format("Select * FROM [{0}]", sheets.FirstOrDefault());
                        oda = new OleDbDataAdapter(query, excelConnection);
                        oda.Fill(ds);
                        DataTable Exceldt = ds.Tables[0];

                        string sqlconn = ConfigurationManager.ConnectionStrings["dbcon"].ConnectionString;
                        con = new SqlConnection(sqlconn);
                        //creating object of SqlBulkCopy
                        objbulk = new SqlBulkCopy(con);
                        //assigning Destination table name

                        objbulk.DestinationTableName = "EMS_Leave_Balance_Temp";
                        //Mapping Table column
                        objbulk.ColumnMappings.Add("Employee Id", "Employee_id");
                        objbulk.ColumnMappings.Add("CL", "CL");
                        objbulk.ColumnMappings.Add("EL", "EL");
                        objbulk.ColumnMappings.Add("ML", "ML");
                        objbulk.ColumnMappings.Add("LOP", "LOP");
                        objbulk.ColumnMappings.Add("WFH", "WFH");

                        //inserting Datatable Records to DataBase
                        con.Open();
                        objbulk.WriteToServer(Exceldt);
                        con.Close();
                        flag = true;
                    }

                    if (flag)
                    {
                        if (!CommonRepo.LoadDataFromTable())
                        {
                            return(Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_305", "Some problem in Stored Procedure", "Some problem in Stored Procedure")));
                        }
                    }
                    return(Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_306", "Leave Balance updated successfully", "Leave Balance updated successfully")));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_307", "Invalid File", "Invalid File")));
                }
            }
            catch (OleDbException e)
            {
                Debug.WriteLine(e.Message);
                Debug.WriteLine(e.GetBaseException());
                return(Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_308", "Invalid Excel Sheet", e.Message)));
            }
            catch (InvalidOperationException e)
            {
                Debug.WriteLine(e.Message);
                Debug.WriteLine(e.GetBaseException());
                return(Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_308", "Mandatory columns are missing", e.Message)));
            }
            catch (IOException IOException)
            {
                Debug.WriteLine(IOException.Message);
                Debug.WriteLine(IOException.GetBaseException());
                return(Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_308", "Please select a file to upload", IOException.Message)));
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                Debug.WriteLine(e.GetBaseException());
                return(Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_308", "Application Error", e.Message)));
            }
        }
コード例 #14
0
        private async void DataSourceWin_Loaded(object sender, RoutedEventArgs e)
        {
            dataSourceTypes = await CommonRepo.GetDataSourceTypes();

            sourceTypeCB.ItemsSource = dataSourceTypes;
        }