Пример #1
0
        private void LoadTraceInfo(string custid)
        {
            dalCustomerLog dallog = new dalCustomerLog();
            BindingCollection <modCustomerLog> listlog = dallog.GetIList(custid, string.Empty, string.Empty, string.Empty, "1", string.Empty, string.Empty, out Util.emsg);

            DBGridTrace.DataSource = listlog;
        }
Пример #2
0
 private void mnuCustomerLog_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (DBGrid.CurrentRow == null)
         {
             return;
         }
         modCustomerList mod    = (modCustomerList)DBGrid.CurrentRow.DataBoundItem;
         dalCustomerLog  dallog = new dalCustomerLog();
         BindingCollection <modCustomerLog> listlog = dallog.GetIList(mod.CustId, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, out Util.emsg);
         if (listlog != null && listlog.Count > 0)
         {
             frmViewList frm = new frmViewList();
             frm.InitViewList(clsTranslate.TranslateString("Customer Log"), listlog);
             frm.ShowDialog();
         }
         else
         {
             if (!string.IsNullOrEmpty(Util.emsg))
             {
                 MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show(clsTranslate.TranslateString("No data found!"), 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 txtContent_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         TextBox txt = (TextBox)sender;
         if (rbSchedule.Checked)
         {
             frmViewText frm = new frmViewText(clsTranslate.TranslateString("Action Schedule"), txt.Text.Trim());
             frm.ShowDialog();
         }
         else
         {
             string traceflaglist = string.Empty;
             if (rbCustomerLog.Checked)
             {
                 traceflaglist = "1";
             }
             dalCustomerLog dal = new dalCustomerLog();
             BindingCollection <modCustomerLog> list = dal.GetIList(string.Empty, string.Empty, string.Empty, txtSalesMan.Text, traceflaglist, ((TextBox)sender).Tag.ToString(), DateTime.Parse(txt.Tag.ToString()).AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss"), out Util.emsg);
             if (list != null)
             {
                 frmViewList frm = new frmViewList();
                 frm.InitViewList(clsTranslate.TranslateString("Customer Log"), list);
                 frm.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Пример #4
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;
            }
        }