Пример #1
0
 private void menuStatus_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         TextBox txt = (TextBox)contextMenuStrip1.SourceControl;
         dalCrmActionSchedule dal = new dalCrmActionSchedule();
         modCrmActionSchedule mod = dal.GetItem(txtSalesMan.Text, DateTime.Parse(txt.Tag.ToString()), out Util.emsg);
         EditScheduleStatus(ref mod, ref txt);
         mod = dal.GetItem(txtSalesMan.Text, DateTime.Parse(txt.Tag.ToString()), out Util.emsg);
         if (mod.Status == 0)
         {
             txt.ReadOnly  = false;
             txt.ForeColor = Color.Black;
         }
         else if (mod.Status == 1)
         {
             txt.ReadOnly  = true;
             txt.ForeColor = Color.DarkGoldenrod;
         }
         else
         {
             txt.ReadOnly  = true;
             txt.ForeColor = Color.DarkGray;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Пример #2
0
 private void txtContent_Validated(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         TextBox txt = (TextBox)sender;
         if (!txt.ReadOnly && rbSchedule.Checked)
         {
             dalCrmActionSchedule dal = new dalCrmActionSchedule();
             if (!dal.Exists(txtSalesMan.Text, Convert.ToDateTime(txt.Tag.ToString()), txt.Text.Trim(), out Util.emsg))
             {
                 bool ret = dal.Delete(txtSalesMan.Text.Trim(), Convert.ToDateTime(txt.Tag.ToString()), out Util.emsg);
                 if (ret)
                 {
                     if (!string.IsNullOrEmpty(txt.Text.Trim()))
                     {
                         modCrmActionSchedule mod = new modCrmActionSchedule();
                         mod.ActionMan     = txtSalesMan.Text.Trim();
                         mod.ActionDate    = Convert.ToDateTime(txt.Tag.ToString());
                         mod.ActionContent = txt.Text.Trim();
                         mod.Status        = 0;
                         mod.UpdateUser    = Util.UserId;
                         ret = dal.Insert(mod, out Util.emsg);
                         if (!ret)
                         {
                             MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                         }
                         else
                         {
                             float fontsize = txt.Font.Size;
                             txt.Font = new Font(txt.Font.FontFamily, 16, txt.Font.Style);
                             txt.Refresh();
                             Thread.Sleep(200);
                             txt.Font = new Font(txt.Font.FontFamily, fontsize, txt.Font.Style);
                             txt.Refresh();
                             txt.ReadOnly         = false;
                             txt.ContextMenuStrip = contextMenuStrip1;
                         }
                     }
                     else
                     {
                         txt.ContextMenuStrip = null;
                     }
                 }
                 else
                 {
                     MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Пример #3
0
        private void LoadData()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                string fromtime = txtContent0101.Tag.ToString();
                string totime   = txtContent0607.Tag.ToString();
                if (rbSchedule.Checked)
                {
                    dalCrmActionSchedule dal = new dalCrmActionSchedule();
                    BindingCollection <modCrmActionSchedule> list = dal.GetIList(string.Empty, txtSalesMan.Text, fromtime, totime, out Util.emsg);
                    if (list != null && list.Count > 0)
                    {
                        foreach (modCrmActionSchedule mod in list)
                        {
                            bool find = false;
                            for (int i = 0; i < 6; i++)
                            {
                                for (int j = 0; j < 7; j++)
                                {
                                    string  txtName = "txtContent" + (i + 1).ToString().PadLeft(2, '0') + (j + 1).ToString().PadLeft(2, '0');
                                    TextBox txt     = (TextBox)(this.Controls.Find(txtName, true))[0];
                                    if (txt.GetType().ToString() == "System.Windows.Forms.TextBox" && txt.Tag != null && txt.Tag.ToString() == mod.ActionDate.ToString("yyyy-MM-dd"))
                                    {
                                        txt.Text = mod.ActionContent;
                                        if (mod.Status == 0)
                                        {
                                            txt.ReadOnly  = false;
                                            txt.ForeColor = Color.Black;
                                        }
                                        else if (mod.Status == 1)
                                        {
                                            txt.ReadOnly  = true;
                                            txt.ForeColor = Color.DarkGoldenrod;
                                        }
                                        else
                                        {
                                            txt.ReadOnly  = true;
                                            txt.ForeColor = Color.DarkGray;
                                        }
                                        txt.ContextMenuStrip = contextMenuStrip1;
                                        find = true;
                                        break;
                                    }
                                }
                                if (find)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (rbCustomerLog.Checked)
                {
                    string actioncodelist = string.Empty;
                    if (lstActionCode.SelectedItems.Count > 0 && lstActionCode.SelectedItems.Count < lstActionCode.Items.Count)
                    {
                        for (int i = 0; i < lstActionCode.SelectedItems.Count; i++)
                        {
                            modCustomerScoreRule mod = (modCustomerScoreRule)lstActionCode.SelectedItems[i];
                            if (i == 0)
                            {
                                actioncodelist = mod.ActionCode;
                            }
                            else
                            {
                                actioncodelist += "," + mod.ActionCode;
                            }
                        }
                    }

                    dalCustomerLog dal = new dalCustomerLog();
                    BindingCollection <modCustomerDailyLog> list = dal.GetCustomerDailyLog(actioncodelist, txtSalesMan.Text, fromtime, totime, out Util.emsg);
                    if (list != null && list.Count > 0)
                    {
                        foreach (modCustomerDailyLog mod in list)
                        {
                            bool find = false;
                            for (int i = 0; i < 6; i++)
                            {
                                for (int j = 0; j < 7; j++)
                                {
                                    string  txtName = "txtContent" + (i + 1).ToString().PadLeft(2, '0') + (j + 1).ToString().PadLeft(2, '0');
                                    TextBox txt     = (TextBox)(this.Controls.Find(txtName, true))[0];
                                    if (txt.GetType().ToString() == "System.Windows.Forms.TextBox" && txt.Tag != null && txt.Tag.ToString() == mod.ActionDate)
                                    {
                                        txt.Text = mod.ActionContent;
                                        find     = true;
                                        break;
                                    }
                                }
                                if (find)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
                else
                {
                    string actioncodelist = string.Empty;
                    if (lstActionCode.SelectedItems.Count > 0 && lstActionCode.SelectedItems.Count < lstActionCode.Items.Count)
                    {
                        for (int i = 0; i < lstActionCode.SelectedItems.Count; i++)
                        {
                            modCustomerScoreRule mod = (modCustomerScoreRule)lstActionCode.SelectedItems[i];
                            if (i == 0)
                            {
                                actioncodelist = mod.ActionCode;
                            }
                            else
                            {
                                actioncodelist += "," + mod.ActionCode;
                            }
                        }
                    }
                    dalCustomerLog dal = new dalCustomerLog();
                    BindingCollection <modCustomerDailyScores> list = dal.GetCustomerDailyScores(actioncodelist, txtSalesMan.Text, fromtime, totime, out Util.emsg);
                    if (list != null && list.Count > 0)
                    {
                        foreach (modCustomerDailyScores mod in list)
                        {
                            bool find = false;
                            for (int i = 0; i < 6; i++)
                            {
                                for (int j = 0; j < 7; j++)
                                {
                                    string  txtName = "txtContent" + (i + 1).ToString().PadLeft(2, '0') + (j + 1).ToString().PadLeft(2, '0');
                                    TextBox txt     = (TextBox)(this.Controls.Find(txtName, true))[0];
                                    if (txt.GetType().ToString() == "System.Windows.Forms.TextBox" && txt.Tag != null && txt.Tag.ToString() == mod.ActionDate)
                                    {
                                        txt.Text = "积分:" + mod.Scores.ToString();
                                        find     = true;
                                        break;
                                    }
                                }
                                if (find)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }