Esempio n. 1
0
        public JsonResult AddUpdate(string jData = "", string dataSource = "")
        {
            int    count     = 0;
            string tableName = "";

            if (!String.IsNullOrEmpty(jData))
            {
                List <ResourceListAuto> resources = JsonConvert.DeserializeObject <List <ResourceListAuto> >(jData);
                if (resources != null && resources.Count() > 0)
                {
                    tableName = resources.FirstOrDefault().TableRender;
                    new SqlResourceListAutoDao().Clear(tableName);
                    foreach (ResourceListAuto resource in resources)
                    {
                        resource.Status      = 1;
                        resource.CreatedDate = DateTime.Now;
                        resource.UpdatedDate = DateTime.Now;
                        if (new SqlResourceListAutoDao().Insert(resource))
                        {
                            count++;
                        }
                    }
                }
            }
            if (count > 0)
            {
                string redirectUrl = "/Configulation/Resource/?par=" + StaticFunc.Base64Encode(tableName + "#" + dataSource);
                return(Json(redirectUrl, JsonRequestBehavior.AllowGet));
            }
            return(Json("", JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
 /// <summary>
 /// Генерирует сетку, проставляет начальную привязку comboBox'ов, <br></br>запускает расчет для синусоидального типа и шагом по сетке (2)-го типа + отрисовка результата.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Form1_Load(object sender, EventArgs e)
 {
     x = StaticFunc.GetMeshX(0, L, N);
     comboBox2.SelectedIndex = 1;
     comboBox1.SelectedIndex = 0;
     RunningSolution();
     PlotSolution(1);
 }
Esempio n. 3
0
        public ActionResult RequiredPermission(string k = "")
        {
            string keyDescrypt = "";

            if (!String.IsNullOrEmpty(k))
            {
                keyDescrypt = StaticFunc.Base64Decode(k);
            }
            ViewBag.PermissionCode = keyDescrypt;
            return(View());
        }
Esempio n. 4
0
        /// <summary>
        /// Запускает расчет для выбранного типа импульса и выбранным шагом по времени.
        /// </summary>
        private void RunningSolution()
        {
            double a = 0.5;
            double T = 1.0;

            M = (int)(T / GetKurant);
            U = StaticFunc.GenerateZerosMatrix(M, N);
            R = StaticFunc.GenerateZerosMatrix(M, N);

            StaticFunc.SolveTask(x, a, L, N, T, GetKurant, GetTypeSolution, ref U, ref R);
            trackBar1.Maximum = R.GetLength(0) - 2;
        }
Esempio n. 5
0
 public ActionResult ChangePassword(ChangePasswordModel model)
 {
     try
     {
         NI10_Employee employee         = (Session["EmployeeLogin"] != null) ? (NI10_Employee)Session["EmployeeLogin"] : new NI10_Employee();
         bool          isADAuthenticate = bool.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings["IsADAuthenticate"]);
         if (isADAuthenticate)
         {
             bool isValidateUser = LdapFunction.IsExists(employee.EmployeeCode);
             if (isValidateUser)
             {
                 if (!String.IsNullOrEmpty(model.NewPassword))
                 {
                     if (StaticFunc.EncryptIntranet(model.CurrentPassword) == employee.CurrentPassword)
                     {
                         LdapFunction.ResetPassword(employee.EmployeeCode, model.NewPassword);
                         employee.CurrentPassword = StaticFunc.EncryptIntranet(model.NewPassword);
                         Session["EmployeeLogin"] = employee;
                     }
                     else
                     {
                         TempData["error"] = "Mật khẩu cũ không trùng khớp";
                     }
                 }
             }
             else
             {
                 TempData["error"] = "Không tìm thấy tài khoản của bạn";
             }
         }
     }
     catch (Exception ex)
     {
         if (ex.ToString().Contains("The password does not meet the password policy requirements"))
         {
             TempData["error"] = "Mật khẩu không được chứa họ,tên,tên đệm";
         }
         else
         {
             TempData["error"] = ex.ToString();
         }
     }
     if (TempData["error"] != null)
     {
         return(Redirect("/User/Profile"));
     }
     else
     {
         TempData["success"] = "Cập nhập thành công!";
         return(Redirect("/User/Login/?returnUrl=/"));
     }
 }
Esempio n. 6
0
 public JsonResult UploadAvatar(HttpPostedFileBase fileImport = null)
 {
     try
     {
         NI10_Employee employee        = (Session["EmployeeLogin"] != null) ? (NI10_Employee)Session["EmployeeLogin"] : new NI10_Employee();
         string        l_imageFileName = "";
         if (Request.Files != null)
         {
             foreach (string file in Request.Files)
             {
                 var uploadedFile = Request.Files[file];
                 if (uploadedFile.ContentLength > 0)
                 {
                     List <string> array = new List <string> {
                         "jpg", "JPG", "jpeg", "JPEG", "icon", "BMP", "bmp", "png", "PNG"
                     };
                     if (array.Contains(uploadedFile.ContentType.Split('/')[1].ToString()) == true)
                     {
                         Bitmap photoFile = StaticFunc.ResizeImage(uploadedFile.InputStream, 200, 200);
                         string img_duoi  = "." + uploadedFile.ContentType.Split('/')[1].ToString();
                         l_imageFileName = employee.EmployeeCode + DateTime.Now.ToString("yyyyMMddHHmmss") + img_duoi;
                         var         appData = Server.MapPath("/Files/Avatar/");
                         ImageFormat format  = StaticFunc.ConvertImageToByteArray(img_duoi);
                         photoFile.Save(Server.MapPath("/Files/Avatar/" + l_imageFileName), format);
                         if (l_imageFileName != "")
                         {
                             PutDataResponse dataResponse = DataFunction.PutDataToService(serviceUrl, "Request/GetData", "",
                                                                                          new List <string>()
                             {
                                 "@EmployeeCode", employee.EmployeeCode,
                                 "@Avatar", l_imageFileName
                             },
                                                                                          "[dbo].[NI10_Employee_UpdateAvatar]");
                             return(Json("/Files/Avatar/" + l_imageFileName, JsonRequestBehavior.AllowGet));
                         }
                     }
                     else
                     {
                         return(Json("0", JsonRequestBehavior.AllowGet)); // File không đúng định dạng ảnh. Vui lòng đổi ảnh khác
                     }
                 }
             }
         }
         return(Json("-1", JsonRequestBehavior.AllowGet)); // Xảy ra lỗi trong quá trình xử lý dữ liệu
     }
     catch (Exception ex)
     {
         return(Json("-1", JsonRequestBehavior.AllowGet)); // Xảy ra lỗi trong quá trình xử lý dữ liệu
     }
 }
Esempio n. 7
0
        public static MDEvent Parsing(byte[] buffer, ref int offset, MDEvent bef_event)
        {
            int oldoffset = offset;
            int delta     = StaticFunc.ReadDeltaTime(buffer, ref offset);

            if (buffer[offset] == 0xFF)
            {
                offset++;
                return(MetaEvent.MakeEvent(delta, buffer, ref offset, oldoffset));
            }
            if (buffer[offset] < 0xF0)
            {
                return(MidiEvent.makeEvent(buffer[offset++], delta, buffer, ref offset, oldoffset, bef_event.EventType));
            }
            return(SysEvent.MakeEvent(buffer[offset++], delta, buffer, ref offset, oldoffset));
        }
Esempio n. 8
0
        // GET: Resource
        public ActionResult Index(string par = "")
        {
            string tableName  = "";
            string dataSource = "";

            if (!String.IsNullOrEmpty(par))
            {
                string parDecrypt = StaticFunc.Base64Decode(par);
                if (parDecrypt != "")
                {
                    string[] parArr = parDecrypt.Split('#');
                    if (parArr != null && parArr.Count() == 2)
                    {
                        tableName  = parArr[0].ToString();
                        dataSource = parArr[1].ToString();
                    }
                }
            }
            ViewBag.Tables     = new SqlSelectListDao().GetSelectLists("spSelectList_GetTableConfiged");
            ViewBag.TableName  = tableName;
            ViewBag.DataSource = dataSource;
            return(View());
        }
Esempio n. 9
0
        public ActionResult Login(LoginModel model)
        {
            string        result = "", actiontype = "";
            NI10_Employee employee = new SqlNI10_EmployeeDao().GetSingleByCustomDataSource(new object[] { "@employeeCode", model.LoginName }, "[dbo].[NI10_Employee_GetEmployeeInfo]");

            if (employee != null)
            {
                if (isADAuthenticate)
                {
                    if (ValidateUserLDAP(model.LoginName, model.PassWord.Trim()) == false)
                    {
                        UserPrincipal userPrincipal = LdapFunction.GetUserPrincipal(model.LoginName);
                        if (userPrincipal != null)
                        {
                            if (userPrincipal.AccountExpirationDate != null)
                            {
                                actiontype = "1";
                                result     = "Tài khoản đã nghỉ việc. Vui lòng liên hệ support để hỗ trợ";
                            }
                            else if (userPrincipal.AccountLockoutTime != null)
                            {
                                actiontype = "1";
                                result     = "Tài khoản của bạn đã bị khóa. Vui lòng liên hệ support để hỗ trợ";
                                Session["countLoginFail"] = "0";
                            }
                            else
                            {
                                result     = "Username hoặc password không đúng. Vui lòng kiểm tra lại";
                                actiontype = "1";
                            }
                        }
                        TempData["error"] = result;
                    }
                    else
                    {
                        actiontype = "0";
                        this.FillLoginInfo(employee.JobTitle, model.LoginName.Trim(), employee.FullName, employee.EmployeeCode, "", false, "", "", employee.Avatar, "false", 0, StaticFunc.EncryptIntranet(model.PassWord.Trim()), employee.EmailAddress);
                        if (model.ReturnUrl == null)
                        {
                            return(Redirect("/TankList/Home"));
                        }
                        return(Redirect(model.ReturnUrl));
                    }
                }
            }
            return(View());
        }
Esempio n. 10
0
        public ActionResult AddUpdate(TasklistModel model, HttpPostedFileBase[] AttachFile)
        {
            WriteLogError(JsonConvert.SerializeObject(model));

            #region Upload File
            List <FileStringItem> fileStringItems = new List <FileStringItem>();
            if (model.FileString != null)
            {
                fileStringItems = JsonConvert.DeserializeObject <List <FileStringItem> >(model.FileString);
            }
            if (AttachFile != null && AttachFile.Count() > 0 && AttachFile[0] != null)
            {
                foreach (HttpPostedFileBase file in AttachFile)
                {
                    string         fileName = UploadFile(file, "/Files/TaskList");
                    FileStringItem fileItem = new FileStringItem()
                    {
                        FileID   = 0,
                        FileName = fileName,
                        FilePath = "/Files/TaskList/" + fileName
                    };
                    fileStringItems.Add(fileItem);
                }
            }
            #endregion

            List <CheckListItem>    checkListItems = JsonConvert.DeserializeObject <List <CheckListItem> >(model.CheckList);
            List <OptionStringItem> optionItems    = JsonConvert.DeserializeObject <List <OptionStringItem> >(model.OptionString);

            List <ObjectStringModel> ObjectString = new List <ObjectStringModel>();
            string            fileStr             = JsonConvert.SerializeObject(fileStringItems).ToString();
            ObjectStringModel abc = new ObjectStringModel
            {
                TaskID             = model.TaskID,
                ParentID           = model.ParentID,
                TaskTitle          = model.TaskTitle,
                ItemsDesc          = model.ItemsDesc,
                TaskType           = model.TaskType,
                StatusType         = model.StatusType,
                FileString         = fileStringItems,
                PriorityLevel      = model.PriorityLevel,
                CheckList          = checkListItems,
                OptionString       = optionItems,
                FromDateTime       = StaticFunc.ConvertFormDateTime(Request["FromDateTime"]).ToString("MM/dd/yyyy HH:mm"),
                ToDateTime         = StaticFunc.ConvertFormDateTime(Request["ToDateTime"]).ToString("MM/dd/yyyy HH:mm"),
                CompletedDatetime  = StaticFunc.ConvertFormDateTime(Request["CompletedDatetime"]).ToString("MM/dd/yyyy HH:mm"),
                FromDateRepeat     = StaticFunc.ConvertFormDate(Request["FromDateRepeat"]).ToString("MM/dd/yyyy HH:mm"),
                ToDateRepeat       = StaticFunc.ConvertFormDate(Request["ToDateRepeat"]).ToString("MM/dd/yyyy HH:mm"),
                IsRepeated         = model.IsRepeated,
                RepeatType         = model.RepeatType,
                InTimeString       = model.InTimeString,
                InWeekdayString    = model.InWeekdayString,
                InMonthdayString   = model.InMonthdayString,
                ObjectInChargeType = model.ObjectInChargeType,
                ObjectInCharge     = model.ObjectInCharge,
                IsActive           = "1",
                IsFollow           = Request["IsFollow"] == "1" ? "True" : "False",
                PersonsControl     = model.PersonsControl,
            };
            ObjectString.Add(abc);
            string test = JsonConvert.SerializeObject(ObjectString);
            WriteLogError(Request["FromDateTime"].ToString());
            WriteLogError(Request["ToDateTime"].ToString());
            WriteLogError(test);
            //return View();
            string          serviceUrl    = ConfigurationManager.AppSettings["ServiceUrl"];
            PutDataResponse AddUpdateTask = DataFunction.PutDataToService(serviceUrl, "Request/GetData", "", new List <string>()
            {
                "@SSID", "", "@ACTION", "SAVE", "@OBJECTID", "", "@USERID", SEmployee.EmployeeCode, "@TaskID", model.TaskID.ToString(), "@ObjectString", test
            }, "[dbo].[NI09_TaskList_Items_save]");
            if (AddUpdateTask.StatusCode == "DONE")
            {
                TempData["success"] = "Cập nhật dữ liệu thành công";
            }
            else
            {
                TempData["error"] = AddUpdateTask.StatusMess;
            }
            return(Redirect("/TaskList/Home/Detail?id=" + model.TaskID));
        }