Пример #1
0
        //确定
        private void okBtn_Click(object sender, EventArgs e)
        {
            string depart = ComboDeparts.Text.Trim();
            if (depart == "")
            {
                BathClass.printErrorMsg("需要填写呈交部门");
                ComboDeparts.SelectAll();
                ComboDeparts.Focus();
            }

            var log = new DepartmentLog();
            log.date = DateTime.Now;
            log.departId = db.Department.FirstOrDefault(x => x.name == depart).id;

            if (m_Image1 != null)
                log.img = m_Image1;

            if (m_Image2 != null)
                log.img2 = m_Image2;

            if (m_Image3 != null)
                log.img3 = m_Image3;

            string msg = TextMsg.Text.Trim();
            if (msg != "")
                log.msg = msg;

            if (!CheckAnonymous.Checked)
                log.sender = LogIn.m_User.name;

            db.DepartmentLog.InsertOnSubmit(log);
            db.SubmitChanges();
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Пример #2
0
 partial void DeleteDepartmentLog(DepartmentLog instance);
Пример #3
0
 partial void InsertDepartmentLog(DepartmentLog instance);
Пример #4
0
 partial void UpdateDepartmentLog(DepartmentLog instance);
Пример #5
0
        private void create_msgPanel(DepartmentLog log, ref int y, int v_space)
        {
            int w = PanelLogs.Width;
            var p = new MsgPanel.LogPanel();
            p.Location = new Point((w - p.Width) / 2, y);
            p.setDate(log.date.Value);
            p.setSender(log.sender);
            p.setToDepart(db.Department.FirstOrDefault(x => x.id == log.departId).name);
            PanelLogs.Controls.Add(p);

            string img1Url = log.imgUrl;
            string img2Url = log.img2Url;
            string img3Url = log.img3Url;

            if (img1Url != null)
                img1Url = "ftp://" + connectionIP + "/" + img1Url;

            if (img2Url != null)
                img2Url = "ftp://" + connectionIP + "/" + img2Url;

            if (img3Url != null)
                img3Url = "ftp://" + connectionIP + "/" + img3Url;
            p.setImg(img1Url, img2Url, img3Url);

            p.id = log.id;
            p.setMsg(log.msg);

            bool done = MConvert<bool>.ToTypeOrDefault(log.done, false);
            bool urgent = MConvert<bool>.ToTypeOrDefault(log.urgent, false);
            p.set_panel_status(done, urgent, log.doneDate, log.urgentDate, log.dueTime);

            p.BtnSetTimeClicked +=new LogPanel.BtnSetTimeClickHandle(p_BtnSetTimeClicked);
            p.BtnUrgentClicked += new LogPanel.BtnUrgentClickHandle(p_BtnUrgentClicked);
            p.BtnDoneClicked += new LogPanel.BtnDoneClickHandle(p_BtnDoneClicked);
            y += p.Size.Height + v_space;
        }