Ejemplo n.º 1
0
 public IEnumerable <OrderProduct> GetChildProducts(string productNo, IEnumerable <Box> boxes, IEnumerable <Frame> frames)
 {
     using (DataSet ds = ExecuteQuery(string.Format(@"SELECT Products.ProductSizeA, Products.ProductSizeB, Products.BackProductCostPrice, ProductType.ProductTypeNO,ProductType.ProductTypeName, BackProductTypeNO, BackProductNO, Products.ProductNO, Products.ProductName, ProductSize=(Products.ProductSizeA + '*' + Products.ProductSizeB), Fram, Box, Unit, Page, Paper, film, InsidePage, Biao, Ban, Diao, ProductCostPrice, Products.ProductSellingPrice, Products.ProductDescribe, Products.IsCountNumber, Products.ProductNumber, Products.NoticeNumber, Products.ProductImage, Products.[Create], Products.CreateDate, Products.IsDelete 
                                     FROM Products INNER JOIN ProductType ON Products.ProductTypeNO = ProductType.ProductTypeNO 
                                     WHERE IsDelete = 0 AND ProductNO LIKE '{0}_sub%'", productNo)))
     {
         try
         {
             return(from DataRow dr in ds.Tables[0].Rows select new OrderProduct
             {
                 Ban = dr["Ban"].SafeDbString(),
                 Biao = dr["Biao"].SafeDbString(),
                 Box = Box.Parse(dr["Box"].SafeDbString(), boxes),
                 Diao = dr["Diao"].SafeDbString(),
                 Film = dr["Film"].SafeDbString(),
                 Fram = Frame.Parse(dr["Fram"].SafeDbString(), frames),
                 InsidePage = dr["InsidePage"].SafeDbString(),
                 NegativeQuantity = 0,
                 PageQuantity = 0,
                 Paper = dr["Paper"].SafeDbString(),
                 ProduceState = "正常",
                 ProductMemory = string.Empty,
                 ProductNo = dr["ProductNo"].SafeDbString(),
                 ProductQuantity = 1,
                 Unit = dr["Unit"].SafeDbString()
             });
         }
         catch
         {
             MessageBoxEx.Error(string.Format(@"在数据库中查询子产品列表时遇到了问题导致失败!{0}方法名称:'OrderProducts.GetGetChildProducts'", Environment.NewLine));
         }
         return(new OrderProduct[] {});
     }
 }
Ejemplo n.º 2
0
        public void InitOrderShoot(string orderNO, string shootType)
        {
            try
            {
                if (shootType != ShootType.Outside)
                {
                    ExecuteNonQuery(string.Format(@"
                    IF NOT EXISTS (SELECT 1 FROM OrderShoot WHERE OrderNO = '{0}' AND ShootType = '内景' AND RecordState = 0)
                    BEGIN
	                    INSERT INTO OrderShoot(OrderNO, ShootType, ShootState, RecordState)
                        VALUES ('{0}', '内景', '初始化', 3)
                    END", orderNO));
                }
                if (shootType != ShootType.Inside)
                {
                    ExecuteNonQuery(string.Format(@"
                    IF NOT EXISTS (SELECT 1 FROM OrderShoot WHERE OrderNO = '{0}' AND ShootType = '外景' AND RecordState = 0)
                    BEGIN
	                    INSERT INTO OrderShoot(OrderNO, ShootType, ShootState, RecordState)
                        VALUES ('{0}', '外景', '初始化', 3)
                    END", orderNO));
                }
                LogManagement.SaveOperateLog(orderNO, LogType.Shoot, string.Format(@"初始化[{0}]摄影记录", shootType));
                LogManagement.SaveOrderLog(orderNO, LogType.Shoot, string.Format(@"初始化[{0}]摄影记录", shootType));
            }
            catch (Exception ex)
            {
                MessageBoxEx.Error(string.Format(@"初始化摄影记录失败!{0}{1}", Environment.NewLine, ex.Message));
            }
        }
Ejemplo n.º 3
0
        public bool UpdateCustomer(string customerNO, string cardType, string cardNO, string introducerType, string introducerCardNO,
                                   string customerName1, string birthdayYear1, string birthdayDay1, string birthdayMonth1, string theGregorianCalendar1,
                                   string mobilePhone1, string mobilePhoneIsLose1, string telephone1, string telephoneIsLose1, string qq_msn1,
                                   string email1, string job1, string jobName1, string address1, string zipCode1,
                                   string customerName2, string birthdayYear2, string birthdayDay2, string birthdayMonth2, string theGregorianCalendar2,
                                   string mobilePhone2, string mobilePhoneIsLose2, string telephone2, string telephoneIsLose2, string qq_msn2,
                                   string email2, string job2, string jobName2, string address2, string zipCode2,
                                   string isLetterAddress, string marryDate, string marryDate2, string customerSource, string customerSourceName,
                                   string imformationSource, string imformationSourceName, string wishRecommend, string wishRecommendName, string customerMemory,
                                   string customerState, string isDelete, string n_address1, string n_address2, string n_address3,
                                   string v_address1, string v_address2, string v_address3, string address, string zipCode, string isEnableAddress)
        {
            try
            {
                string strSql = string.Format(@"
                                                        UPDATE Customers 
                                                        SET 
                                                        CardType='{1}', CardNO='{2}', IntroducerType='{3}', IntroducerCardNO='{4}', CustomerName1='{5}',
                                                        BirthdayYear1='{6}', BirthdayDay1='{7}', BirthdayMonth1='{8}', TheGregorianCalendar1= '{9}', MobilePhone1='{10}', 
                                                        MobilePhoneIsLose1='{11}', Telephone1='{12}', TelephoneIsLose1='{13}', QQ_MSN1='{14}', Email1='{15}',
                                                        Job1='{16}', JobName1='{17}', Address1='{18}', ZipCode1='{19}', CustomerName2='{20}', 
                                                        BirthdayYear2='{21}', BirthdayDay2='{22}', BirthdayMonth2='{23}', TheGregorianCalendar2='{24}', MobilePhone2='{25}', 
                                                        MobilePhoneIsLose2='{26}', Telephone2='{27}', TelephoneIsLose2='{28}', QQ_MSN2='{29}', Email2='{30}',
                                                        Job2='{31}', JobName2='{32}', Address2='{33}', ZipCode2='{34}', IsLetterAddress='{35}', 
                                                        MarryDate='{36}', MarryDate2='{37}', CustomerSource='{38}', CustomerSourceName='{39}', ImformationSource='{40}',
                                                        ImformationSourceName='{41}', WishRecommend='{42}', WishRecommendName='{43}', CustomerMemory='{44}', CustomerState='{45}',  
                                                        IsDelete='{46}', N_Address_1='{47}', N_Address_2='{48}', N_Address_3='{49}', v_Address_1='{50}',
                                                        v_Address_2='{51}', v_Address_3='{52}'  
                                                        WHERE CustomerNO='{0}' 

                                                        IF EXISTS(SELECT 1 FROM Letters WHERE CustomerNO='{0}') 
                                                        BEGIN
	                                                        UPDATE Letters 
	                                                        SET [Address]='{53}', ZipCode='{54}', IsEnableAddress='{55}' 
	                                                        WHERE CustomerNO='{0}'
                                                        END
                                                        ELSE BEGIN
	                                                        INSERT INTO Letters (CustomerNO, [Address], ZipCode, IsEnableAddress)
	                                                        VALUES('{0}', '{53}', '{54}', '{55}')
                                                        END",
                                              customerNO, cardType, cardNO, introducerType, introducerCardNO,
                                              customerName1, birthdayYear1, birthdayDay1, birthdayMonth1, theGregorianCalendar1,
                                              mobilePhone1, mobilePhoneIsLose1, telephone1, telephoneIsLose1, qq_msn1,
                                              email1, job1, jobName1, address1, zipCode1,
                                              customerName2, birthdayYear2, birthdayDay2, birthdayMonth2, theGregorianCalendar2,
                                              mobilePhone2, mobilePhoneIsLose2, telephone2, telephoneIsLose2, qq_msn2,
                                              email2, job2, jobName2, address2, zipCode2,
                                              isLetterAddress, marryDate, marryDate2, customerSource, customerSourceName,
                                              imformationSource, imformationSourceName, wishRecommend, wishRecommendName, customerMemory,
                                              customerState, isDelete, n_address1, n_address2, n_address3,
                                              v_address1, v_address2, v_address3, address, zipCode, isEnableAddress);
                ExecuteNonQuery(strSql);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBoxEx.Error(ex.Message);
                return(false);
            }
        }
Ejemplo n.º 4
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            Scene scene = (Scene)ObjectToNew;

            // 场景信息是否完整
            if (string.IsNullOrWhiteSpace(scene.Name))
            {
                MessageBoxEx.Error(@"请填写场景名称!");
                txtObjectName.Highlight();
                return;
            }

            // 检测场景是否已存在
            if (DressManager.IsSceneExists(scene))
            {
                MessageBoxEx.Error(string.Format(@"名称为'{0}'的场景已经存在!", scene.Name));
                txtObjectName.Highlight();
                return;
            }

            try
            {
                DressManager.NewScene(scene);
                OnSaveComplete();
            }
            catch (Exception ex)
            {
                MessageBoxEx.Error(ex.Message);
                OnSaveFailed();
            }
        }
Ejemplo n.º 5
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            Theme theme = (Theme)ObjectToNew;

            // 风格信息是否完整
            if (string.IsNullOrWhiteSpace(theme.Name))
            {
                MessageBoxEx.Error(@"请填写风格名称!");
                txtObjectName.Highlight();
                return;
            }

            // 检测风格是否已存在
            if (DressManager.IsThemeExists(theme))
            {
                MessageBoxEx.Error(string.Format(@"名称为'{0}'的风格已经存在!", theme.Name));
                txtObjectName.Highlight();
                return;
            }

            try
            {
                DressManager.NewTheme(theme);
                OnSaveComplete();
            }
            catch (Exception ex)
            {
                MessageBoxEx.Error(ex.Message);
                OnSaveFailed();
            }
        }
Ejemplo n.º 6
0
 private void lbpwd_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(cmbUserName.Text))
     {
         MessageBoxEx.Error(@"登录名不能为空,请重新输入!");
         cmbUserName.Focus();
         cmbUserName.SelectAll();
     }
 }
Ejemplo n.º 7
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     try
     {
         DressManager.NewCrossReservation(_crossReservationToNew);
         LoadCrossVenue(_crossReservationToNew.VenueID);
     }
     catch (Exception ex)
     {
         MessageBoxEx.Error(ex.Message);
     }
 }
Ejemplo n.º 8
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         DressManager.DeleteCrossReservation(SelectedCrossReservation);
         LoadCrossVenue(SelectedCrossReservation.VenueID);
     }
     catch (Exception ex)
     {
         MessageBoxEx.Error(ex.Message);
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 获取套系产品
 /// </summary>
 /// <param name="suiteNo">套系编号</param>
 /// <param name="boxes">包装数据集</param>
 /// <param name="frames">框条数据集</param>
 /// <returns>套系产品</returns>
 public IEnumerable <OrderProduct> GetSuiteProducts(string suiteNo, IEnumerable <Box> boxes, IEnumerable <Frame> frames)
 {
     using (DataSet ds = ExecuteQuery(string.Format(@"SELECT *, Size = ProductSizeA + '*' + ProductSizeB FROM dbo.V_SearchSuiteProduct WHERE SuiteNO='{0}'", suiteNo)))
     {
         try
         {
             return(from DataRow row in ds.Tables[0].Rows select OrderProduct.FromSuiteProduct(row, boxes, frames));
         }
         catch
         {
             MessageBoxEx.Error(string.Format(@"在数据库中查询套系产品列表时遇到了问题导致失败!{0}方法名称:'OrderProducts.GetSuiteProducts'", Environment.NewLine));
         }
         return(new OrderProduct[] {});
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 获取产品类型列表
 /// </summary>
 /// <returns>产品类型列表</returns>
 public IEnumerable <string> GetProductTypes()
 {
     using (DataSet ds = ExecuteQuery(@"SELECT ProductTypeName FROM ProductType"))
     {
         try
         {
             return(from DataRow row in ds.Tables[0].Rows select row["ProductTypeName"].SafeDbString());
         }
         catch
         {
             MessageBoxEx.Error(string.Format(@"在数据库中查询产品类型列表时遇到了问题导致失败!{0}方法名称:'OrderProducts.GetProductTypes'", Environment.NewLine));
         }
         return(new string[] { });
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 获取框条
 /// </summary>
 /// <returns>框条</returns>
 public IEnumerable <Frame> GetFrames()
 {
     using (DataSet ds = ExecuteQuery(@"SELECT * FROM RequireSub WHERE RequireID = 2"))
     {
         try
         {
             return(from DataRow row in ds.Tables[0].Rows select Frame.FromDataRow(row));
         }
         catch
         {
             MessageBoxEx.Error(string.Format(@"在数据库中查询框条列表时遇到了问题导致失败!{0}方法名称:'OrderProducts.GetFrames'", Environment.NewLine));
         }
         return(new Frame[] {});
     }
 }
Ejemplo n.º 12
0
 public bool SetShootMemory(string orderNO, string memory)
 {
     try
     {
         ExecuteNonQuery(string.Format(@"UPDATE OrderShoot SET ShootMemory = '{0}' WHERE OrderNO = '{1}'", memory, orderNO));
         LogManagement.SaveOperateLog(orderNO, LogType.Shoot, string.Format(@"修改摄影备注为[{0}]", memory));
         LogManagement.SaveOrderLog(orderNO, LogType.Shoot, string.Format(@"修改摄影备注为[{0}]", memory));
         return(true);
     }
     catch (Exception ex)
     {
         MessageBoxEx.Error(ex.Message);
         return(false);
     }
 }
Ejemplo n.º 13
0
 public IEnumerable <Department> GetDepartments()
 {
     using (DataSet dsEmployee = ExecuteQuery(@"SELECT * FROM Department WHERE IsDelete = 0"))
     {
         try
         {
             return(from DataRow row in dsEmployee.Tables[0].Rows select Department.FromDataRow(row));
         }
         catch
         {
             MessageBoxEx.Error(string.Format(@"在数据库中查询部门列表时遇到了问题导致失败!{0}方法名称:'CompanyManagement.GetDepartments'", Environment.NewLine));
         }
         return(new Department[] { });
     }
 }
Ejemplo n.º 14
0
 public IEnumerable <Employee> GetDepartmentEmployeeList(string departmentNo)
 {
     using (DataSet dsEmployee = GetDepartmentEmployee(departmentNo))
     {
         try
         {
             return(from DataRow row in dsEmployee.Tables[0].Rows select Employee.FromDataRow(row));
         }
         catch
         {
             MessageBoxEx.Error(string.Format(@"在数据库中查询部门员工列表时遇到了问题导致失败!{0}方法名称:'CompanyManagement.GetDepartmentEmployeeList'", Environment.NewLine));
         }
         return(new Employee[] {});
     }
 }
Ejemplo n.º 15
0
 public IEnumerable <SuiteType> GetSuiteTypes()
 {
     using (DataSet ds = ExecuteQuery(@"SELECT * FROM SuiteType"))
     {
         try
         {
             return(from DataRow row in ds.Tables[0].Rows select SuiteType.FromDataRow(row));
         }
         catch
         {
             MessageBoxEx.Error(string.Format(@"在数据库中查询套系类别列表时遇到了问题导致失败!{0}方法名称:'OrderProducts.GetSuiteTypes'", Environment.NewLine));
         }
         return(new SuiteType[] {});
     }
 }
Ejemplo n.º 16
0
 public IEnumerable <OrderSource> GetOrderSources()
 {
     using (DataSet dsOrderSource = GetConfig(@"WHERE ConfigType='订单来源'"))
     {
         try
         {
             return(from DataRow row in dsOrderSource.Tables[0].Rows select OrderSource.FromDataRow(row));
         }
         catch
         {
             MessageBoxEx.Error(string.Format(@"在数据库中查询订单来源时遇到了问题导致失败!{0}方法名称:'ConfigManagement.GetOrderSources'", Environment.NewLine));
         }
         return(new OrderSource[] {});
     }
 }
Ejemplo n.º 17
0
        private void btnDeleteObject_Click(object sender, EventArgs e)
        {
            MessageBoxEx.Error(@"尚未实现!");

            //            // 删除确认
            //            if(DialogResult.OK != MessageBoxEx.Confirm(@"请注意!
            //删除场馆后,从属于该场馆的所有风格和场景极其照片也将会被删除!
            //建议使用“停用”功能。
            //确定要删除该场馆吗?"))
            //            {
            //                return;
            //            }

            //            // 开始删除
            //    StartBackWork(ProcDelete);
        }
Ejemplo n.º 18
0
 public CustomerInfo GetCustomerInfo(string customerNO)
 {
     using (DataSet dsCustomer = ExecuteQuery(string.Format(@"SELECT * FROM dbo.v_SearchCustomer WHERE CustomerNO = '{0}'", customerNO)))
     {
         DataRow dr = null;
         try
         {
             dr = dsCustomer.Tables[0].Rows[0];
         }
         catch
         {
             MessageBoxEx.Error(string.Format(@"在数据库中查询用户信息时遇到了问题导致失败!{0}方法名称:'CustomerManagement.GetCustomerInfo'", Environment.NewLine));
         }
         return(CustomerInfo.FromDataRow(dr));
     }
 }
Ejemplo n.º 19
0
        private void photoManager_AddPhotoButtonClick(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(ServerPath))
            {
                MessageBoxEx.Error(@"请先选择一个上传路径!");
                cmbServerPath.Focus();
                return;
            }

            OpenFileDialog dlg = new OpenFileDialog
            {
                Multiselect = true,
                Filter      = DressManager.OriginalPhotoFileFilter
            };

            if (DialogResult.OK == dlg.ShowDialog())
            {
                // 检测重名的文件
                List <string> duplicatedFilesName = new List <string>();
                List <string> files = new List <string>();
                foreach (string fileName in dlg.FileNames)
                {
                    string name = fileName;
                    if (photoManager.Photos.Paths.Exists(fn => Path.GetFileNameWithoutExtension(fn) == Path.GetFileNameWithoutExtension(name)))
                    {
                        duplicatedFilesName.Add(Path.GetFileName(name));
                    }
                    else
                    {
                        files.Add(name);
                    }
                }

                // 提示存在重名文件
                if (duplicatedFilesName.Count > 0
                    &&
                    DialogResult.OK != MessageBoxEx.Confirm(string.Format(@"以下照片的文件名与现有照片的文件名重复:
{0}
这些文件将不会被添加,是否继续?", string.Join(Environment.NewLine, duplicatedFilesName.ToArray()))))
                {
                    return;
                }

                // 开始添加
                StartBackWork(ProcAddPhoto, files);
            }
        }
Ejemplo n.º 20
0
 /// <summary>
 /// 获取产品
 /// </summary>
 /// <param name="boxes">包装数据集</param>
 /// <param name="frames">框条数据集</param>
 /// <returns>套系产品</returns>
 public IEnumerable <OrderProduct> GetProducts(IEnumerable <Box> boxes, IEnumerable <Frame> frames)
 {
     using (DataSet ds = ExecuteQuery(@"SELECT Products.ProductNo, Products.ProductName, ProductType.ProductTypeName, Size=(Products.ProductSizeA + '*' + Products.ProductSizeB), Fram, Box, Unit, Paper, film, InsidePage, Biao, Ban, Diao 
                                       FROM Products INNER JOIN ProductType ON Products.ProductTypeNO=ProductType.ProductTypeNO 
                                       WHERE IsDelete=0 AND Products.ProductNo NOT LIKE '%_sub%'"))
     {
         try
         {
             return(from DataRow row in ds.Tables[0].Rows select OrderProduct.FromProduct(row, boxes, frames));
         }
         catch
         {
             MessageBoxEx.Error(string.Format(@"在数据库中查询产品列表时遇到了问题导致失败!{0}方法名称:'OrderProducts.GetProducts'", Environment.NewLine));
         }
         return(new OrderProduct[] { });
     }
 }
Ejemplo n.º 21
0
        public IEnumerable <MoreInfoItem> GetMoreInfoItems(int pid)
        {
            string strSql = string.Format(@"SELECT * FROM MoreInfo WHERE PID {0}", pid == 0 ? @"IS NULL" : string.Format(@"= {0}", pid));

            using (DataSet ds = ExecuteQuery(strSql))
            {
                try
                {
                    return(from DataRow row in ds.Tables[0].Rows select MoreInfoItem.FromDataRow(row));
                }
                catch
                {
                    MessageBoxEx.Error(string.Format(@"在数据库中查询更多信息列表时遇到了问题导致失败!{0}方法名称:'OrderManagement.GetMoreInfoItems'", Environment.NewLine));
                }
                return(new MoreInfoItem[] { });
            }
        }
Ejemplo n.º 22
0
 private void ProcDelete()
 {
     if (DialogResult.OK != MessageBoxEx.Confirm(string.Format(@"确定要移除对象'{0}'吗?", SelectedDressBarCode)))
     {
         return;
     }
     try
     {
         string dressBarCode = SelectedDressBarCode;
         DressManager.DeleteThemeDress(CurrentTheme, dressBarCode, CurrentTypeID);
         DressBarCodes = DressBarCodes.Where(s => s != dressBarCode).ToList();
     }
     catch (Exception ex)
     {
         MessageBoxEx.Error(string.Format(@"移除失败,原因为{0}{1}", Environment.NewLine, ex.Message));
     }
 }
Ejemplo n.º 23
0
 private void btnChangeArea_Click(object sender, EventArgs e)
 {
     new FrmAreaPicker
     {
         AfterPick = node =>
         {
             try
             {
                 RuleObject area = (RuleObject)node.Tag;
                 DressManager.ChangeArea(Barcode, area, venueName, Information.CurrentUser.EmployeeNO2, Information.CurrentUser.EmployeeDepartmentNO);
                 MessageBoxEx.Info(@"变更成功!");
             }
             catch (Exception ex)
             {
                 MessageBoxEx.Error(ex.Message);
             }
         }
     }.Show();
 }
Ejemplo n.º 24
0
        private void ProcAdd()
        {
            try
            {
                DressManager.NewThemeDress(CurrentTheme, DressBarCodeToAdd, CurrentTypeID);
                IList <string> DressNosNow = new List <string>(DressBarCodes);
                DressNosNow.Add(DressBarCodeToAdd);
                DressBarCodes = DressNosNow;
            }
            catch (SqlException sqlEx)
            {
                string errMessage;
                switch (sqlEx.Number)
                {
                case SqlExceptionType.DressBarCodeNotExists:
                {
                    errMessage = @"当前输入的条码不存在!";
                    break;
                }

                case SqlExceptionType.PrimaryKeyDuplicated:
                {
                    errMessage = @"当前输入的条码已经与该风格关联过了!";
                    break;
                }

                default:
                {
                    errMessage = string.Format(@"添加失败,原因为{0}{1}", Environment.NewLine, sqlEx.Message);
                    break;
                }
                }
                MessageBoxEx.Error(errMessage);
                txtDressBarCode.Highlight();
            }
            catch (Exception ex)
            {
                MessageBoxEx.Error(string.Format(@"添加失败,原因为{0}{1}", Environment.NewLine, ex.Message));
                txtDressBarCode.Highlight();
            }
        }
Ejemplo n.º 25
0
        private void ModifyOld()
        {
            string serverPhotoPath = null;

            try
            {
                UpdateWaitMessage(@"上传照片");
                serverPhotoPath = DressManager.UploadDressPhoto(PhotoFilePath, ServerPath);

                UpdateWaitMessage(@"写入数据库");
                DressManager.OldDressModify(DressToNew, serverPhotoPath);

                Invoke((Action)(() =>
                {
                    CloseWaitFrm();
                    MessageBoxEx.Info(@"修改礼服成功!");
                    txtBarCode.Text = string.Empty;
                }));
            }
            catch (Exception ex)
            {
                try
                {
                    // 删除服务器上已经上传的照片
                    if (null != serverPhotoPath)
                    {
                        DressManager.DeleteDressPhoto(serverPhotoPath);
                    }

                    Invoke((Action)(() =>
                    {
                        CloseWaitFrm();
                        MessageBoxEx.Error(string.Format(@"修改礼服失败!{0}{1}", Environment.NewLine, ex.Message));
                    }));
                }
                catch
                {
                    // 防止二次报错
                }
            }
        }
Ejemplo n.º 26
0
 private void 屏蔽ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvDressesShow.CurrentRow != null && dgvDressesShow.CurrentRow.Cells["DressStatus"].Value.ToString() == @"屏蔽")
         {
             MessageBox.Show(@"该礼服已屏蔽!");
             return;
         }
         if (dgvDressesShow.CurrentRow != null)
         {
             DressManager.EliminateDress(dgvDressesShow.CurrentRow.Cells["DressBarCode"].Value.ToString(), @"屏蔽");
             MessageBoxEx.Info(@"屏蔽成功!");
             dgvDressesShow.CurrentRow.Cells["DressStatus"].Value = @"屏蔽";
         }
     }
     catch (Exception ex)
     {
         MessageBoxEx.Error(ex.Message);
     }
 }
Ejemplo n.º 27
0
        private void btnSaveObject_Click(object sender, EventArgs e)
        {
            Venue SelectedVenue = (Venue)SelectedObject;

            // 场馆信息是否完整
            if (string.IsNullOrWhiteSpace(SelectedVenue.Name))
            {
                MessageBoxEx.Error(@"请填写场馆名称!");
                txtObjectName.Highlight();
                return;
            }

            try
            {
                DressManager.UpdateVenue(SelectedVenue);
                OnSaveComplete();
            }
            catch (Exception ex)
            {
                MessageBoxEx.Error(ex.Message);
                OnSaveFailed();
            }
        }
Ejemplo n.º 28
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            Venue venue = (Venue)ObjectToNew;

            // 场馆信息是否完整
            if (string.IsNullOrWhiteSpace(venue.DepartmentNo))
            {
                MessageBoxEx.Error(@"请选择一个专业部门的编号,作为场馆关联的部门编号!");
                tvwDepartment.Focus();
                return;
            }
            if (string.IsNullOrWhiteSpace(venue.Name))
            {
                MessageBoxEx.Error(@"请填写场馆名称!");
                txtObjectName.Highlight();
                return;
            }
            // 检测场馆是否已存在
            if (DressManager.IsVenueExists(venue))
            {
                MessageBoxEx.Error(string.Format(@"关联部门编号为'{0}'或名称为'{1}'的场馆已经存在!", venue.DepartmentNo, venue.Name));
                tvwDepartment.Focus();
                return;
            }

            try
            {
                DressManager.NewVenue(venue);
                OnSaveComplete();
            }
            catch (Exception ex)
            {
                MessageBoxEx.Error(ex.Message);
                OnSaveFailed();
            }
        }
Ejemplo n.º 29
0
        public void CanEnterWaitDelayShoot(string orderNO, string type)
        {
            // 订单是否确定了拍摄类型
            string strShootType = ExecuteScalar(string.Format(@"SELECT ShootSites FROM Orders WHERE IsDelete = 0 AND OrderNO = '{0}'", orderNO)).SafeDbString();

            if (string.IsNullOrWhiteSpace(strShootType))
            {
                throw new OrderException(OrderExceptionType.Normal, @"该订单尚未确定拍摄的类型(内景、外景、全套),不能安排重拍,请完善订单资料!");
            }

            try
            {
                // 订单是否进入过等待拍摄的状态
                HasEnteredWaitShoot(orderNO);
            }
            catch (OrderException ex)
            {
                MessageBoxEx.Error(ex.Message);
                return;
            }
            if (ShootType.All == type) // 排全套
            {
                // 是否对应
                if (ShootType.All != strShootType)
                {
                    throw new OrderException(OrderExceptionType.Normal, string.Format(@"该订单的拍摄类型为'{0}',不能安排'{1}'摄控", strShootType, type));
                }

                // 是否还有没拍完的
                using (DataSet ds = ExecuteQuery(string.Format(@"SELECT ShootState, ShootType, CASE WHEN DATEDIFF(dd, ShootDate, '1900-01-01') = 0 THEN NULL ELSE ShootDate END AS ShootDate FROM OrderShoot WHERE IsDelete = 0 AND OrderNO = '{0}'", orderNO)))
                {
                    if (ds.IsEmpty())
                    {
                        throw new OrderException(OrderExceptionType.Normal, @"该订单没有拍摄记录!");
                    }
                    StringBuilder sb = new StringBuilder();
                    using (DataTable dt = ds.Tables[0])
                    {
                        foreach (DataRow dr in dt.Rows.Cast <DataRow>().Where(dr => dr["ShootDate"].SafeDbDateTime().Equals(DateTime.MinValue)))
                        {
                            sb.AppendLine(string.Format(@"'{0}'的'{1}' 尚未拍摄完成!", dr["ShootState"].SafeDbString(), dr["ShootType"].SafeDbString()));
                        }
                    }
                    if (sb.Length > 0)
                    {
                        throw new OrderException(OrderExceptionType.Normal, string.Format(@"该订单不能安排'{0}'补拍,因为:{1}{2}", type, Environment.NewLine, sb));
                    }
                }
            }
            else if (ShootType.Inside == type) // 排内景
            {
                // 是否对应
                if (ShootType.Outside == strShootType)
                {
                    throw new OrderException(OrderExceptionType.Normal, string.Format(@"该订单的拍摄类型为'{0}',不能安排'{1}'摄控", strShootType, type));
                }

                // 是否还有没拍完的
                using (DataSet ds = ExecuteQuery(string.Format(@"SELECT ShootState, CASE WHEN DATEDIFF(dd, ShootDate, '1900-01-01') = 0 THEN NULL ELSE ShootDate END AS ShootDate FROM OrderShoot WHERE IsDelete = 0 AND ShootType = '内景' AND OrderNO = '{0}'", orderNO)))
                {
                    if (ds.IsEmpty())
                    {
                        throw new OrderException(OrderExceptionType.Normal, @"该订单没有拍摄记录!");
                    }
                    StringBuilder sb = new StringBuilder();
                    using (DataTable dt = ds.Tables[0])
                    {
                        foreach (DataRow dr in dt.Rows.Cast <DataRow>().Where(dr => dr["ShootDate"].SafeDbDateTime().Equals(DateTime.MinValue)))
                        {
                            sb.AppendLine(string.Format(@"'{0}'的'内景' 尚未拍摄完成!", dr["ShootState"].SafeDbString()));
                        }
                    }
                    if (sb.Length > 0)
                    {
                        throw new OrderException(OrderExceptionType.Normal, string.Format(@"该订单不能安排'{0}'补拍,因为:{1}{2}", type, Environment.NewLine, sb));
                    }
                }
            }
            else if (ShootType.Outside == type) // 排外景
            {
                // 是否对应
                if (ShootType.Inside == strShootType)
                {
                    throw new OrderException(OrderExceptionType.Normal, string.Format(@"该订单的拍摄类型为'{0}',不能安排'{1}'摄控", strShootType, type));
                }

                // 是否还有没拍完的
                using (DataSet ds = ExecuteQuery(string.Format(@"SELECT ShootState, CASE WHEN DATEDIFF(dd, ShootDate, '1900-01-01') = 0 THEN NULL ELSE ShootDate END AS ShootDate FROM OrderShoot WHERE IsDelete = 0 AND ShootType = '外景' AND OrderNO = '{0}'", orderNO)))
                {
                    if (ds.IsEmpty())
                    {
                        throw new OrderException(OrderExceptionType.Normal, @"该订单没有拍摄记录!");
                    }
                    StringBuilder sb = new StringBuilder();
                    using (DataTable dt = ds.Tables[0])
                    {
                        foreach (DataRow dr in dt.Rows.Cast <DataRow>().Where(dr => dr["ShootDate"].SafeDbDateTime().Equals(DateTime.MinValue)))
                        {
                            sb.AppendLine(string.Format(@"'{0}'的'外景' 尚未拍摄完成!", dr["ShootState"].SafeDbString()));
                        }
                    }
                    if (sb.Length > 0)
                    {
                        throw new OrderException(OrderExceptionType.Normal, string.Format(@"该订单不能安排'{0}'补拍,因为:{1}{2}", type, Environment.NewLine, sb));
                    }
                }
            }
        }
Ejemplo n.º 30
0
 private void BindEvents()
 {
     //
     // txtCustomCode
     //
     txtCustomCode.LostFocus += (sender, args) => DressToNew.CustomCode = ((TextBox)sender).Text;
     //
     // txtBarCode
     //
     txtBarCode.LostFocus += (sender, args) => DressToNew.BarCode = ((TextBox)sender).Text;
     //
     // cmbType
     //
     cmbType.SelectedIndexChanged += (sender, args) =>
     {
         ComboBox   cmb  = (ComboBox)sender;
         RuleObject type = (RuleObject)cmb.SelectedItem;
         if (null == type)
         {
             DressToNew.TypeNo = null;
             Categories        = null;
         }
         else
         {
             DressToNew.TypeNo = type.RuleNo.ToString();
             Categories        = DressManager.FilterRules(Rules, type.RuleNo).ToList();
         }
     };
     //
     // cmbColor
     //
     cmbColor.LostFocus += (sender, args) => DressToNew.ColorName = ((ComboBox)sender).Text;
     //
     // cmbCategory
     //
     cmbCategory.SelectedIndexChanged += (sender, args) =>
     {
         ComboBox   cmb      = (ComboBox)sender;
         RuleObject category = (RuleObject)cmb.SelectedItem;
         DressToNew.CategoryNo = null == category ? null : category.RuleNo.ToString();
     };
     //
     // cmbBrand
     //
     cmbBrand.LostFocus += (sender, args) => DressToNew.BrandName = ((ComboBox)sender).Text;
     //
     // cmbOrnamental
     //
     cmbOrnamental.LostFocus += (sender, args) => DressToNew.OrnamentalName = ((ComboBox)sender).Text;
     //
     // cmbUpperStyle
     //
     cmbUpperStyle.LostFocus += (sender, args) => DressToNew.UpperStyleName = ((ComboBox)sender).Text;
     //
     // cmbLowerStyle
     //
     cmbLowerStyle.LostFocus += (sender, args) => DressToNew.LowerStyleName = ((ComboBox)sender).Text;
     //
     // cmbUpperMaterial
     //
     cmbUpperMaterial.LostFocus += (sender, args) => DressToNew.UpperMaterialName = ((ComboBox)sender).Text;
     //
     // cmbLowerMaterial
     //
     cmbLowerMaterial.LostFocus += (sender, args) => DressToNew.LowerMaterialName = ((ComboBox)sender).Text;
     //
     // cmbUse
     //
     cmbUse.LostFocus += (sender, args) => DressToNew.UseName = ((ComboBox)sender).Text;
     //
     // cmbSupplier
     //
     cmbSupplier.LostFocus += (sender, args) => DressToNew.SupplierName = ((ComboBox)sender).Text;
     //
     // cmbLevel
     //
     cmbLevel.LostFocus += (sender, args) =>
     {
         ComboBox cmb   = (ComboBox)sender;
         Level    level = (Level)cmb.SelectedItem;
         DressToNew.LevelNo = null == level ? null : level.No;
     };
     //
     // txtBuyer
     //
     txtBuyer.LostFocus += (sender, args) => DressToNew.SupplierName = ((TextBox)sender).Text;
     //
     // numUsedToday
     //
     numUsedToday.LostFocus += (sender, args) =>
     {
         NumericUpDown numric = (NumericUpDown)sender;
         DressToNew.NumOfUsedToday = string.IsNullOrWhiteSpace(numric.Text) ? 0 : Convert.ToInt32(numric.Value);
     };
     //
     // numNOTime
     //
     numNOTime.LostFocus += (sender, args) =>
     {
         NumericUpDown numric = (NumericUpDown)sender;
         DressToNew.NOTime = string.IsNullOrWhiteSpace(numric.Text) ? 0 : Convert.ToInt32(numric.Value);
     };
     //
     // txtCost
     //
     txtCost.LostFocus += (sender, args) =>
     {
         CashTextBox txt = (CashTextBox)sender;
         if (string.IsNullOrWhiteSpace(txt.Text))
         {
             DressToNew.CostPrice = decimal.Zero;
         }
         else
         {
             decimal cost;
             if (decimal.TryParse(txt.Text, out cost))
             {
                 DressToNew.CostPrice = cost;
             }
             else
             {
                 MessageBoxEx.Error(@"价格输入有误!");
                 txt.Highlight();
             }
         }
     };
     //
     // txtRent
     //
     txtRent.LostFocus += (sender, args) =>
     {
         CashTextBox txt = (CashTextBox)sender;
         if (string.IsNullOrWhiteSpace(txt.Text))
         {
             DressToNew.RentPrice = decimal.Zero;
         }
         else
         {
             decimal rent;
             if (decimal.TryParse(txt.Text, out rent))
             {
                 DressToNew.RentPrice = rent;
             }
             else
             {
                 MessageBoxEx.Error(@"价格输入有误!");
                 txt.Highlight();
             }
         }
     };
     //
     // txtSale
     //
     txtSale.LostFocus += (sender, args) =>
     {
         CashTextBox txt = (CashTextBox)sender;
         if (string.IsNullOrWhiteSpace(txt.Text))
         {
             DressToNew.SalePrice = decimal.Zero;
         }
         else
         {
             decimal sale;
             if (decimal.TryParse(txt.Text, out sale))
             {
                 DressToNew.SalePrice = sale;
             }
             else
             {
                 MessageBoxEx.Error(@"价格输入有误!");
                 txt.Highlight();
             }
         }
     };
     //
     // txtSource
     //
     txtSource.LostFocus += (sender, args) => DressToNew.Source = ((TextBox)sender).Text;
     //
     // txtDescription
     //
     txtDescription.LostFocus += (sender, args) => DressToNew.Description = ((TextBox)sender).Text;
     //
     // txtNote
     //
     txtNote.LostFocus += (sender, args) => DressToNew.Notes = ((TextBox)sender).Text;
     //
     // cmbServer
     //
     cmbServerPath.LostFocus += (sender, args) => ServerPath = ((ComboBox)sender).Text;
     //
     // photoPicker
     //
     photoPicker.PhotoFilePathChanged += (sender, args) => PhotoFilePath = ((SinglePhotoPicker)sender).PhotoFilePath;
 }