Beispiel #1
0
        //检查月份合法性
        private bool CheckValidMonth()
        {
            List <bool> bits = new List <bool>();

            foreach (Control c in _groupBoxProductTime.Controls)
            {
                Panel p = c as Panel;
                if (p != null && p.Name == "panelPrdsTimeMonth")
                {
                    foreach (Control cc in p.Controls)
                    {
                        ucMonths ucM = cc as ucMonths;
                        if (ucM != null)
                        {
                            foreach (CheckBox cb in ucM)
                            {
                                bits.Add(cb.Checked);
                            }
                        }
                    }
                    break;
                }
            }
            return(CheckAtLeastOne(bits));
        }
Beispiel #2
0
 /// <summary>
 /// 拼接同期查询sql
 /// </summary>
 /// <param name="ui"></param>
 private void ConcatISCCPSQLByProductTimeOverTheSamePeriod(UIControls ui)
 {
     _sql.Append("Year(ReceiveTime)>=").Append(_dateTimeBegin.Split('-')[0]);
     _sql.Append(" and ");
     _sql.Append("Year(ReceiveTime)<=").Append(_dateTimeEnd.Split('-')[0]).Append(" and (");
     switch (_productPeriod)
     {
     case "月产品":
     {
         foreach (Control c in ui.GroupBoxProductTime.Controls)
         {
             Panel p = c as Panel;
             if (p != null && p.Name == "panelPrdsTimeMonth")
             {
                 foreach (Control cc in p.Controls)
                 {
                     ucMonths ucM = cc as ucMonths;
                     if (ucM != null)
                     {
                         bool checkedPrevious = false;
                         int  month           = 0;
                         foreach (CheckBox cb in ucM)
                         {
                             AppendOr(ref checkedPrevious, cb.Checked, "Month(ReceiveTime)", ++month);
                         }
                         _sql.Append(");");
                         break;
                     }
                 }
                 break;
             }
         }
         break;
     }
     }
 }
Beispiel #3
0
        /// <summary>
        /// 拼接同期查询sql
        /// </summary>
        /// <param name="ui"></param>
        private void ConcatSQLByProductTimeOverTheSamePeriod(UIControls ui)
        {
            _sql.Append("DataYear>=").Append(_dateTimeBegin);
            _sql.Append(" and ");
            _sql.Append("DataYear<=").Append(_dateTimeEnd).Append(" and (");
            switch (_productPeriod)
            {
            case "旬产品":
            {
                foreach (Control c in ui.GroupBoxProductTime.Controls)
                {
                    Panel p = c as Panel;
                    if (p != null && p.Name == "panelPrdsTimeMonth")
                    {
                        foreach (Control cc in p.Controls)
                        {
                            ucMonths ucM = cc as ucMonths;
                            if (ucM != null)
                            {
                                bool checkedPrevious = false;
                                int  month           = 0;
                                foreach (CheckBox cb in ucM)
                                {
                                    AppendOr(ref checkedPrevious, cb.Checked, "DataMonth", ++month);
                                }
                                _sql.Append(") and (");
                                break;
                            }
                        }
                    }
                    else if (p != null && p.Name == "panelPrdsTimeTen")
                    {
                        bool checkedPrevious = false;
                        foreach (Control cc in p.Controls)
                        {
                            CheckBox cb = cc as CheckBox;
                            if (cb != null && cb.Checked)
                            {
                                switch (cb.Text)
                                {
                                case "上旬":
                                {
                                    AppendOr(ref checkedPrevious, cb.Checked, "Data10Day", 1);
                                    break;
                                }

                                case "中旬":
                                {
                                    AppendOr(ref checkedPrevious, cb.Checked, "Data10Day", 2);
                                    break;
                                }

                                case "下旬":
                                {
                                    AppendOr(ref checkedPrevious, cb.Checked, "Data10Day", 3);
                                    break;
                                }
                                }
                            }
                        }
                        //_sql.Append(");");
                        _sql.Append(");");
                    }
                }
                break;
            }

            case "月产品":
            {
                foreach (Control c in ui.GroupBoxProductTime.Controls)
                {
                    Panel p = c as Panel;
                    if (p != null && p.Name == "panelPrdsTimeMonth")
                    {
                        foreach (Control cc in p.Controls)
                        {
                            ucMonths ucM = cc as ucMonths;
                            if (ucM != null)
                            {
                                bool checkedPrevious = false;
                                int  month           = 0;
                                foreach (CheckBox cb in ucM)
                                {
                                    AppendOr(ref checkedPrevious, cb.Checked, "DataMonth", ++month);
                                }
                                //_sql.Append(");");
                                _sql.Append(");");                                        break;
                            }
                        }
                        break;
                    }
                }
                break;
            }
            }
        }