Exemple #1
0
        public void PutControl(FaxPropertyControl control)
        {
            try
            {
                panelControl.SuspendLayout();
                SuspendLayout();

                int y = 0;
                foreach (
                    Control con in
                    panelControl.Controls.Cast <Control>().Where(con => con is FaxPropertyControl && con.Bottom > y)
                    )
                {
                    y = con.Bottom;
                }

                control.Size     = new Size(panelControl.Width, control.Height);
                control.Location = new Point(0, y);
                control.Anchor   = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
                panelControl.Controls.Add(control);
                panelControl.ResumeLayout(false);
                ResumeLayout(false);
            }
            catch (Exception ex)
            {
                Lib.Win.Data.Env.WriteToLog(ex);
            }
        }
Exemple #2
0
        public static void Fax0utFillClass(PropertiesFaxDialog dialog, int faxID, DataRow dr)
        {
            try
            {
                var resources = new ResourceManager(typeof(FaxFillClass));
                if (dr == null)
                {
                    return;
                }

                // наличие документа
                int    imageID = 0;
                object obj     = dr[Environment.FaxOutData.DocImageIDField];
                if (obj != null && !obj.Equals(DBNull.Value))
                {
                    imageID = (int)obj;
                }

                FaxPropertyControl fpc;

                if (imageID > 0)
                {
                    fpc = new FaxPropertiButtonControl("", resources.GetString("FaxSaved"), 2);
                    ((FaxPropertiButtonControl)fpc).FaxID = faxID;
                }
                else
                {
                    fpc = new FaxPropertyControl("", resources.GetString("FaxNotSave"));
                }
                dialog.PutControl(fpc);
                // описание
                fpc = new FaxPropertyControl(resources.GetString("Description"),
                                             (string)dr[Environment.FaxOutData.DescriptionField]);
                dialog.PutControl(fpc);

                // отправлен
                var date = (DateTime)dr[Environment.FaxOutData.DateField];
                fpc = new FaxPropertyControl(resources.GetString("FaxOut"),
                                             ObjectToString.Convert(date.ToLocalTime()));
                dialog.PutControl(fpc);

                // отправитель
                fpc = new FaxPropertyControl(resources.GetString("Sender"),
                                             (string)dr[Environment.FaxOutData.SenderField]);
                dialog.PutControl(fpc);

                // получатель
                if (Equals(dr[Environment.FaxOutData.RecipField], dr[Environment.FaxOutData.RecvAddressField]))
                {
                    fpc = new FaxPropertiButtonControl(resources.GetString("Recip"),
                                                       (string)dr[Environment.FaxOutData.RecipField], 1);
                }
                else
                {
                    fpc = new FaxPropertyControl(resources.GetString("Recip"),
                                                 (string)dr[Environment.FaxOutData.RecipField]);
                }
                dialog.PutControl(fpc);

                // телефон получателя
                fpc = new FaxPropertyControl(resources.GetString("RecvAddress"),
                                             (string)dr[Environment.FaxOutData.RecvAddressField]);
                dialog.PutControl(fpc);

                // CSID
                fpc = new FaxPropertyControl("CSID:", (string)dr[Environment.FaxOutData.CSIDField]);
                dialog.PutControl(fpc);

                // Modem
                fpc = new FaxPropertyControl(resources.GetString("ModemID"),
                                             dr[Environment.FaxOutData.ModemIDField].ToString());
                dialog.PutControl(fpc);

                // скорость передачи
                string speed = dr[Environment.FaxOutData.SpeedField].ToString();
                fpc = new FaxPropertyControl(resources.GetString("Speed"),
                                             speed + ((speed.Length > 0) ? " " + resources.GetString("baud") : ""));
                dialog.PutControl(fpc);

                // время передачи
                string duration = dr[Environment.FaxOutData.DurationField].ToString();
                fpc = new FaxPropertyControl(resources.GetString("Time"),
                                             duration +
                                             ((duration.Length > 0) ? " " + resources.GetString("Second") : ""));
                dialog.PutControl(fpc);

                // отправлено страниц
                fpc = new FaxPropertyControl(resources.GetString("PageSentCount"),
                                             dr[Environment.FaxOutData.PageSentCountField].ToString());
                dialog.PutControl(fpc);

                // изменил
                var empID = (int)dr[Environment.FaxInData.EditorField];
                var emp   = new Employee(empID, Environment.EmpData);
                fpc = empID > 0
                          ? new FaxPropertyEdiorControl(resources.GetString("Editor"), emp.LongName, empID)
                          : new FaxPropertyControl(resources.GetString("Editor"), emp.LongName);
                dialog.PutControl(fpc);

                // изменено
                DateTime editDate = (DateTime)dr[Environment.FaxInData.EditedField] + LocalObject.GetTimeDiff();
                fpc = new FaxPropertyControl(resources.GetString("Edited"), editDate.ToString());
                dialog.PutControl(fpc);
                dialog.Text = resources.GetString("FaxOutText");
                dialog.ResizeForm();
            }
            catch (Exception ex)
            {
                Lib.Win.Data.Env.WriteToLog(ex);
            }
        }