コード例 #1
0
        public ActionResult Insert(ProfileBoxInfomationModel box)
        {
            var path    = box.FolderPath;
            var profile = _profileBoxService.GetByFolderPath(path);

            if (profile != null)
            {
                ErrorNotification(_resourceManager.GetString("Profile.FailedToAddProfileBoxDulicatePath"));
                return(Redirect(Request.UrlReferrer.ToString()));
            }
            else
            {
                ProfileBox newBox = new ProfileBox
                {
                    Name          = box.Name,
                    ADACount      = 0,
                    OfficeId      = _workContext.User.WarehouseId,
                    ProfileCount  = 0,
                    WarehouseId   = _workContext.User.WarehouseId,
                    TypeId        = box.ProfileType,
                    StatusId      = (short)ABO.Core.ProfileBoxStatus.Open,
                    CreatedBy     = _workContext.User.UserID,
                    CreatedDate   = DateTime.Now,
                    UpdatedDate   = DateTime.Now,
                    ScannedFolder = box.FolderPath
                };

                _profileBoxService.Insert(newBox);
                SuccessNotification(_resourceManager.GetString("Profile.SuccessToAddProfileBox") + " File lưu tại: " + path);
                return(Redirect(Request.UrlReferrer.ToString()));
            }
        }
コード例 #2
0
 private void UpdateProfileAndADACount(ProfileBox box)
 {
     box.ProfileCount = _profileRepository.TableNoTracking.Count(x => x.BoxId == box.Id && x.StatusId != (short)ProfileStatus.Deleted);
     box.ADACount     = _profileRepository.TableNoTracking.Where(x => x.BoxId == box.Id && x.StatusId != (short)ProfileStatus.Deleted)
                        .Select(x => x.DistNumber).Distinct().Count();
     _profileBoxRepository.Update(box);
 }
コード例 #3
0
ファイル: ProfileBoxService.cs プロジェクト: 3grkt/ABO
 public void Insert(ProfileBox entity)
 {
     _profileBoxRepository.Insert(entity);
 }
コード例 #4
0
        public byte[] GenerateProfileBoxDetailExcel(IList <Profile> profiles, ProfileBox boxDetail)
        {
            byte[] excelData = new byte[] { };

            using (var excelStream = new MemoryStream())
            {
                using (var inputStream = new MemoryStream())
                {
                    // Copy data to memory to avoid locking file for a long time
                    using (var stream = new FileStream(_webHelper.ProfileBoxDetailExcelTemplate, FileMode.Open))
                    {
                        stream.CopyTo(inputStream);
                    }

                    // Get excel param
                    var excelParams = _excelParamManager.GetExcelParams(ExcelExportType.PROFILEBOX_DETAIL);
                    if (excelParams == null)
                    {
                        throw new ABOException("Excel params are not found. Please check ExcelParams configuration!");
                    }

                    int    tableStartRow    = Convert.ToInt32(excelParams["TableStartRow"]);
                    string cellBoxName      = excelParams["BoxName"];
                    string cellOffice       = excelParams["Office"];
                    string cellWarehouse    = excelParams["Warehouse"];
                    string cellLocation     = excelParams["Location"];
                    string cellProfileCount = excelParams["ProfileCount"];
                    int    colADA           = Convert.ToInt32(excelParams["ADA"]);
                    int    colScanedDate    = Convert.ToInt32(excelParams["ScanedDate"]);
                    int    colProfileStatus = Convert.ToInt32(excelParams["ProfileStatus"]);


                    using (var xlPackage = new ExcelPackage(excelStream, inputStream))
                    {
                        int row       = tableStartRow;
                        var worksheet = xlPackage.Workbook.Worksheets.FirstOrDefault();

                        // Box Name
                        worksheet.Cells[cellBoxName].Value = boxDetail.Name;
                        // Office
                        worksheet.Cells[cellOffice].Value = boxDetail.Office.WarehouseName;
                        // Warehouse
                        worksheet.Cells[cellWarehouse].Value = boxDetail.Warehouse.WarehouseName;
                        // Location
                        worksheet.Cells[cellLocation].Value = (boxDetail.Location != null) ? boxDetail.Location.Name : "";
                        // profileCount
                        worksheet.Cells[cellProfileCount].Value = (boxDetail.ProfileCount == null) ? profiles.Count : boxDetail.ProfileCount;

                        // Insert new empty row
                        worksheet.InsertRow(row, profiles.Count - 1, row);

                        foreach (var profile in profiles)
                        {
                            worksheet.Cells[row, colADA].Value           = profile.DistNumber;
                            worksheet.Cells[row, colScanedDate].Value    = profile.ScannedDate.Value.ToString(_webHelper.DateTimeFormat);
                            worksheet.Cells[row, colProfileStatus].Value = profile.Status.Name;
                            row++;
                        }

                        xlPackage.Save();
                    }
                    excelData = excelStream.ToArray();
                }
            }

            return(excelData);
        }
 private void AdminForm_Click(object sender, EventArgs e)
 {
     Txtpanel.Hide();
     ProfileBox.Hide();
 }
 private void circularPictureBox2_Click(object sender, EventArgs e)
 {
     Txtpanel.Hide();
     ProfileBox.Hide();
 }
 private void TxtProfile_Click(object sender, EventArgs e)
 {
     ProfileBox.Show();
     Txtpanel.Hide();
 }
        private void AdminForm_Load(object sender, EventArgs e)
        {
            Txtnick.Enabled    = false;
            Txtemail.Enabled   = false;
            Txtphone.Enabled   = false;
            Txtmobile.Enabled  = false;
            Txtgender.Enabled  = false;
            Txtaage.Enabled    = false;
            Txtaddress.Enabled = false;

            ProfileBox.Hide();

            Txtid.Text = Login.passtext;
            ////chart view in main
            //try
            //{
            //    con.Open();
            //    SqlCommand cmd = new SqlCommand("select * from Saleinfor",con);
            //    SqlDataReader rd = cmd.ExecuteReader();
            //    Series sr = new Series();
            //    while (rd.Read())
            //    {
            //        chart1.Series[0].Points.AddY(rd.GetInt32(23));
            //    }
            //    con.Close();

            //}
            //catch (Exception)
            //{

            //}
            toolStripStatusLabel.BackColor = Color.LightBlue;
            timer.Text = DateTime.Now.ToLongTimeString();
            timer1.Start();
            Txtpanel.Hide();
            try
            {
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                string ad = "select * from information where email_id='" + Txtid.Text + "'";

                SqlCommand    cmd = new SqlCommand(ad, con);
                SqlDataReader sr  = cmd.ExecuteReader();
                while (sr.Read())
                {
                    string va2 = sr[1].ToString();
                    TxtShowName.Text = Convert.ToString(sr[1].ToString());
                    label1.Text      = Convert.ToString(sr[1].ToString());

                    string val = sr[8].ToString();
                    Txtuser.Text = Convert.ToString(sr[8].ToString());
                    label2.Text  = Convert.ToString(sr[8].ToString());

                    string val3 = sr[0].ToString();
                    label3.Text = Convert.ToString(sr[0].ToString());

                    Txtnick.Text    = Convert.ToString(sr[2].ToString());
                    Txtemail.Text   = Convert.ToString(sr[3].ToString());
                    Txtgender.Text  = Convert.ToString(sr[4].ToString());
                    Txtaage.Text    = Convert.ToString(sr[5].ToString());
                    Txtphone.Text   = Convert.ToString(sr[6].ToString());
                    Txtmobile.Text  = Convert.ToString(sr[7].ToString());
                    Txtaddress.Text = Convert.ToString(sr[9].ToString());

                    if (sr.HasRows)
                    {
                        byte[] img = (byte[])(sr[10]);
                        if (img == null)
                        {
                            circularPictureBox2.Image = null;
                            circularPictureBox3.Image = null;
                            circularPictureBox4.Image = null;
                        }
                        else
                        {
                            MemoryStream ms = new MemoryStream(img);
                            circularPictureBox2.Image = Image.FromStream(ms);
                            circularPictureBox3.Image = Image.FromStream(ms);
                            circularPictureBox4.Image = Image.FromStream(ms);
                        }
                    }
                }
                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (Txtuser.Text == "Admin")
                {
                    employeeToolStripMenuItem.Enabled         = true;
                    EmployeeRegisterToolStripMenuItem.Enabled = true;
                }
                else
                {
                    employeeToolStripMenuItem.Enabled         = false;
                    EmployeeRegisterToolStripMenuItem.Enabled = false;
                }
            }
        }