예제 #1
0
        private async Task <ScriptData> ReadScriptAsync(string phoneNumber)
        {
            // find the file
            string addonUrl   = VersionManager.GetAddOnPackageUrl(Softelvdm.Modules.IVR.Controllers.AreaRegistration.CurrentPackage.AreaName);
            string scriptPath = Path.Combine(Utility.UrlToPhysical(VersionManager.GetCustomUrlFromUrl(addonUrl)), "Scripts", $"TWIML{phoneNumber}.txt");

            Logging.AddLog($"Trying script at {scriptPath}");
            if (!await FileSystem.FileSystemProvider.FileExistsAsync(scriptPath))
            {
                Logging.AddLog($"Script at {scriptPath} not found");
                addonUrl   = VersionManager.GetAddOnPackageUrl(Softelvdm.Modules.IVR.Controllers.AreaRegistration.CurrentPackage.AreaName);
                scriptPath = Path.Combine(Utility.UrlToPhysical(addonUrl), "Scripts", $"TWIML{phoneNumber}.txt");
                Logging.AddLog($"Trying script at {scriptPath}");
                if (!await FileSystem.FileSystemProvider.FileExistsAsync(scriptPath))
                {
                    Logging.AddLog($"Script at {scriptPath} not found");
                    return(null);
                }
            }

            ScriptData script = new ScriptData();

            using (ExtensionEntryDataProvider extensionDP = new ExtensionEntryDataProvider()) {
                DataProviderGetRecords <ExtensionEntry> data = await extensionDP.GetItemsAsync(0, 0, null, null);

                foreach (ExtensionEntry extension in data.Data)
                {
                    Extension ext = new Extension {
                        Digits  = extension.Extension,
                        Name    = extension.Description,
                        Numbers = new List <ExtensionNumber>(),
                    };
                    foreach (ExtensionPhoneNumber extPhone in extension.PhoneNumbers)
                    {
                        ext.Numbers.Add(new ExtensionNumber {
                            Number           = extPhone.PhoneNumber,
                            SendSMSVoiceMail = extPhone.SendSMS,
                        });
                    }
                    script.Extensions.Add(ext);
                }
            }

            // load the contents
            List <string> lines = await FileSystem.FileSystemProvider.ReadAllLinesAsync(scriptPath);

            int total = lines.Count;

            // TWIML Snippets
            int lineIx = 0;

            for ( ; lineIx < total; ++lineIx)
            {
                string l = lines[lineIx].Trim();
                if (l.Length > 0 && !l.StartsWith("##"))
                {
                    // tag and parms
                    List <ScriptEntry> entries = new List <ScriptEntry>();
                    for ( ; ;)
                    {
                        if (l.StartsWith(" "))
                        {
                            if (entries.Count > 0)
                            {
                                break;
                            }
                            throw new InternalError($"Tag name expected on line {lineIx + 1} in {scriptPath}");
                        }
                        ScriptEntry entry  = new ScriptEntry();
                        string[]    tokens = l.Split(new char[] { ' ' });
                        if (tokens.Length < 1 || (tokens.Length % 2) != 1)
                        {
                            throw new InternalError($"Unexpected number of arguments on line {lineIx + 1} in {scriptPath}");
                        }
                        entry.Tag = tokens[0].ToLower();
                        for (int tokIx = 1; tokIx < tokens.Length; tokIx += 2)
                        {
                            entry.Parms.Add(new ScriptParm {
                                Name  = tokens[tokIx],
                                Value = tokens[tokIx + 1],
                            });
                        }
                        ++lineIx;
                        l = lines[lineIx];
                        entries.Add(entry);
                    }

                    // text
                    string text = "";
                    for ( ; lineIx < total; ++lineIx)
                    {
                        l = lines[lineIx];
                        if (l.Length == 0)
                        {
                            break;
                        }
                        if (!l.StartsWith(" "))
                        {
                            throw new InternalError($"Unexpected content (not indented) on line {lineIx + 1} in {scriptPath}");
                        }
                        l     = l.Trim();
                        text += l + "\r\n";
                    }
                    foreach (ScriptEntry entry in entries)
                    {
                        entry.Text = text;
                    }

                    script.Scripts.AddRange(entries);
                }
            }
            return(script);
        }
예제 #2
0
        private async void SignConTemp_Load(object sender, EventArgs e)
        {
            //cmd.ShowOpaqueLayer(this, 125, true);
            bool canview = false;

            try
            {
                //this.MinimizeBox = false;
                //this.MaximizeBox = false;

                if (_type == 1)
                {
                    this.RemarkList.Visible = true;
                    this.RemarkList.Height  = 140;

                    canview = true;
                }
                if (_type == 2)
                {
                    this.RemarkList.Visible = true;
                    this.RemarkList.Height  = 140;

                    canview = true;
                }
                if (_type == 3)
                {
                    this.RemarkList.Visible = true;
                    this.RemarkList.Height  = 140;

                    canview = true;
                }
                if (_type == 4)
                {
                    //选择同意 或  拒绝
                    this.Reason.Visible = true;
                    //两个按钮显示
                    this.AgreeConTemp.Visible  = true;
                    this.RefuseConTemp.Visible = true;
                }
                if (_type == 5)
                {
                }

                HDJContractWithWorkload hdj = new HDJContractWithWorkload();

                //获取该会签单的全部信息   先是模版信息  栏目信息
                hdj = await _sc.GetHDJContractWithWorkload(Id);

                this.ConTempName.Text = hdj.Name;
                this.ConTempId.Text   = hdj.Id;

                List <string> columnlist = new List <string>();
                columnlist        = hdj.ConTemp.ColumnNames;
                this.Column1.Text = columnlist[0].ToString();
                this.Column2.Text = columnlist[1].ToString();
                this.Column3.Text = columnlist[2].ToString();
                this.Column4.Text = columnlist[3].ToString();
                this.Column5.Text = columnlist[4].ToString();

                this.Sign1.Text  = hdj.ConTemp.SignDatas[0].SignInfo.ToString();
                this.Sign2.Text  = hdj.ConTemp.SignDatas[1].SignInfo.ToString();
                this.Sign3.Text  = hdj.ConTemp.SignDatas[2].SignInfo.ToString();
                this.Sign4.Text  = hdj.ConTemp.SignDatas[3].SignInfo.ToString();
                this.Sign5.Text  = hdj.ConTemp.SignDatas[4].SignInfo.ToString();
                this.Sign6.Text  = hdj.ConTemp.SignDatas[5].SignInfo.ToString();
                this.Sign7.Text  = hdj.ConTemp.SignDatas[6].SignInfo.ToString();
                this.Sign8.Text  = hdj.ConTemp.SignDatas[7].SignInfo.ToString();
                this.Sign9.Text  = hdj.ConTemp.SignDatas[8].SignInfo.ToString();
                this.Sign10.Text = hdj.ConTemp.SignDatas[9].SignInfo.ToString();
                this.Sign11.Text = hdj.ConTemp.SignDatas[10].SignInfo.ToString();
                this.Sign12.Text = hdj.ConTemp.SignDatas[11].SignInfo.ToString();

                this.Column1Info.Text = hdj.ColumnDatas[0].ToString();
                this.Column2Info.Text = hdj.ColumnDatas[1].ToString();
                //this.panel4.Height = 100;
                //this.Column3Info.Text = "1   13\r\n2\r\n3\r\n4";
                this.Column4Info.Text = hdj.ColumnDatas[3].ToString();
                this.Column5Info.Text = hdj.ColumnDatas[4].ToString();

                int    num = hdj.WorkLoads.Count;
                string str = "";
                for (int i = 0; i < num; i++)
                {
                    str = str + hdj.WorkLoads[i].Item.Item.ToString() + "   工作量:" + hdj.WorkLoads[i].Work.ToString()
                          + "   投资额:" + hdj.WorkLoads[i].Expense.ToString() + "\r\n";
                }
                this.panel4.Height    = 40 * num;
                this.Column3Info.Text = str;

                //判断当前用户是否有查看功能
                for (int s = 0; s < hdj.ConTemp.SignDatas.Count; s++)
                {
                    if (hdj.ConTemp.SignDatas[s].SignEmployee.Name == UserHelper.UserInfo.Name)
                    {
                        if (hdj.ConTemp.SignDatas[s].CanView == 1)
                        {
                            canview = true;
                        }
                    }
                }

                if (canview)
                {
                    string result1  = hdj.SignResults[0] == 1 ? "(同意)" : (hdj.SignResults[0] == 0 ? "(未处理)" : "(拒绝)");
                    string result2  = hdj.SignResults[1] == 1 ? "(同意)" : (hdj.SignResults[1] == 0 ? "(未处理)" : "(拒绝)");
                    string result3  = hdj.SignResults[2] == 1 ? "(同意)" : (hdj.SignResults[2] == 0 ? "(未处理)" : "(拒绝)");
                    string result4  = hdj.SignResults[3] == 1 ? "(同意)" : (hdj.SignResults[3] == 0 ? "(未处理)" : "(拒绝)");
                    string result5  = hdj.SignResults[4] == 1 ? "(同意)" : (hdj.SignResults[4] == 0 ? "(未处理)" : "(拒绝)");
                    string result6  = hdj.SignResults[5] == 1 ? "(同意)" : (hdj.SignResults[5] == 0 ? "(未处理)" : "(拒绝)");
                    string result7  = hdj.SignResults[6] == 1 ? "(同意)" : (hdj.SignResults[6] == 0 ? "(未处理)" : "(拒绝)");
                    string result8  = hdj.SignResults[7] == 1 ? "(同意)" : (hdj.SignResults[7] == 0 ? "(未处理)" : "(拒绝)");
                    string result9  = hdj.SignResults[8] == 1 ? "(同意)" : (hdj.SignResults[8] == 0 ? "(未处理)" : "(拒绝)");
                    string result10 = hdj.SignResults[9] == 1 ? "(同意)" : (hdj.SignResults[9] == 0 ? "(未处理)" : "(拒绝)");
                    string result11 = hdj.SignResults[10] == 1 ? "(同意)" : (hdj.SignResults[10] == 0 ? "(未处理)" : "(拒绝)");
                    string result12 = hdj.SignResults[11] == 1 ? "(同意)" : (hdj.SignResults[11] == 0 ? "(未处理)" : "(拒绝)");

                    this.SignPer1.Text  = hdj.ConTemp.SignDatas[0].SignEmployee.Name.ToString() + result1;
                    this.SignPer2.Text  = hdj.ConTemp.SignDatas[1].SignEmployee.Name.ToString() + result2;
                    this.SignPer3.Text  = hdj.ConTemp.SignDatas[2].SignEmployee.Name.ToString() + result3;
                    this.SignPer4.Text  = hdj.ConTemp.SignDatas[3].SignEmployee.Name.ToString() + result4;
                    this.SignPer5.Text  = hdj.ConTemp.SignDatas[4].SignEmployee.Name.ToString() + result5;
                    this.SignPer6.Text  = hdj.ConTemp.SignDatas[5].SignEmployee.Name.ToString() + result6;
                    this.SignPer7.Text  = hdj.ConTemp.SignDatas[6].SignEmployee.Name.ToString() + result7;
                    this.SignPer8.Text  = hdj.ConTemp.SignDatas[7].SignEmployee.Name.ToString() + result8;
                    this.SignPer9.Text  = hdj.ConTemp.SignDatas[8].SignEmployee.Name.ToString() + result9;
                    this.SignPer10.Text = hdj.ConTemp.SignDatas[9].SignEmployee.Name.ToString() + result10;
                    this.SignPer11.Text = hdj.ConTemp.SignDatas[10].SignEmployee.Name.ToString() + result11;
                    this.SignPer12.Text = hdj.ConTemp.SignDatas[11].SignEmployee.Name.ToString() + result12;

                    this.RemarkList.Visible = true;
                }
                else
                {
                    this.SignPer1.Text  = hdj.ConTemp.SignDatas[0].SignEmployee.Name.ToString();
                    this.SignPer2.Text  = hdj.ConTemp.SignDatas[1].SignEmployee.Name.ToString();
                    this.SignPer3.Text  = hdj.ConTemp.SignDatas[2].SignEmployee.Name.ToString();
                    this.SignPer4.Text  = hdj.ConTemp.SignDatas[3].SignEmployee.Name.ToString();
                    this.SignPer5.Text  = hdj.ConTemp.SignDatas[4].SignEmployee.Name.ToString();
                    this.SignPer6.Text  = hdj.ConTemp.SignDatas[5].SignEmployee.Name.ToString();
                    this.SignPer7.Text  = hdj.ConTemp.SignDatas[6].SignEmployee.Name.ToString();
                    this.SignPer8.Text  = hdj.ConTemp.SignDatas[7].SignEmployee.Name.ToString();
                    this.SignPer9.Text  = hdj.ConTemp.SignDatas[8].SignEmployee.Name.ToString();
                    this.SignPer10.Text = hdj.ConTemp.SignDatas[9].SignEmployee.Name.ToString();
                    this.SignPer11.Text = hdj.ConTemp.SignDatas[10].SignEmployee.Name.ToString();
                    this.SignPer12.Text = hdj.ConTemp.SignDatas[11].SignEmployee.Name.ToString();

                    this.RemarkList.Visible     = false;
                    this.Reason.Location        = new Point(35, 524);
                    this.AgreeConTemp.Location  = new Point(314, 604);
                    this.RefuseConTemp.Location = new Point(567, 604);
                    this.Height = 710;
                }

                this.RemarkList.Items.Add("备注信息:");

                if (hdj.SignRemarks != null)
                {
                    for (int i = 0; i < hdj.SignRemarks.Count; i++)
                    {
                        if ((hdj.SignRemarks[i]) != "")
                        {
                            this.RemarkList.Items.Add("   " + hdj.ConTemp.SignDatas[i].SignEmployee.Name.ToString() + ":" + hdj.SignRemarks[i].ToString());
                        }
                    }
                }
                //没有信息
                if (this.RemarkList.Items.Count == 1)
                {
                    this.RemarkList.Visible     = false;
                    this.Reason.Location        = new Point(35, 524);
                    this.AgreeConTemp.Location  = new Point(314, 604);
                    this.RefuseConTemp.Location = new Point(567, 604);
                    this.Height = 710;
                }
                //cmd.HideOpaqueLayer();
            }
            catch
            {
                MessageBox.Show("加载数据失败!");
                Logging.AddLog("查看签单详细信息失败!");

                if (MessageBox.Show("好吧,我们的程序出现点问题需要重新启动\n点击\"确定\"重启\n点击\"取消\"退出程序?",
                                    "提示",
                                    MessageBoxButtons.OKCancel,
                                    MessageBoxIcon.Question) == DialogResult.OK)
                {
                    Application.Restart();
                }
                else
                {
                    Application.Exit();
                }
            }
        }
예제 #3
0
        private void EditConTemp_Load(object sender, EventArgs e)
        {
            BindDepartment(UserHelper.DepList);               //绑定部门信息
            try
            {
                Templete temp = new Templete();
                temp = _sc.GetContractTemplate(Id);

                this.ConTempName.Text = temp.Name.ToString();
                this.Column1.Text     = temp.ColumnNames[0].ToString();
                this.Column2.Text     = temp.ColumnNames[1].ToString();
                this.Column3.Text     = temp.ColumnNames[2].ToString();
                this.Column4.Text     = temp.ColumnNames[3].ToString();
                this.Column5.Text     = temp.ColumnNames[4].ToString();

                this.Sign1.Text = temp.SignDatas[0].SignInfo.ToString();
                this.Sign2.Text = temp.SignDatas[1].SignInfo.ToString();
                this.Sign3.Text = temp.SignDatas[2].SignInfo.ToString();
                this.Sign4.Text = temp.SignDatas[3].SignInfo.ToString();
                this.Sign5.Text = temp.SignDatas[4].SignInfo.ToString();
                this.Sign6.Text = temp.SignDatas[5].SignInfo.ToString();
                this.Sign7.Text = temp.SignDatas[6].SignInfo.ToString();
                this.Sign8.Text = temp.SignDatas[7].SignInfo.ToString();

                this.SignDep1.SelectedValue = temp.SignDatas[0].SignEmployee.Department.Id;
                this.SignDep2.SelectedValue = temp.SignDatas[1].SignEmployee.Department.Id;
                this.SignDep3.SelectedValue = temp.SignDatas[2].SignEmployee.Department.Id;
                this.SignDep4.SelectedValue = temp.SignDatas[3].SignEmployee.Department.Id;
                this.SignDep5.SelectedValue = temp.SignDatas[4].SignEmployee.Department.Id;
                this.SignDep6.SelectedValue = temp.SignDatas[5].SignEmployee.Department.Id;
                this.SignDep7.SelectedValue = temp.SignDatas[6].SignEmployee.Department.Id;
                this.SignDep8.SelectedValue = temp.SignDatas[7].SignEmployee.Department.Id;

                this.SignPer1.SelectedValue = temp.SignDatas[0].SignEmployee.Id;
                this.SignPer2.SelectedValue = temp.SignDatas[1].SignEmployee.Id;
                this.SignPer3.SelectedValue = temp.SignDatas[2].SignEmployee.Id;
                this.SignPer4.SelectedValue = temp.SignDatas[3].SignEmployee.Id;
                this.SignPer5.SelectedValue = temp.SignDatas[4].SignEmployee.Id;
                this.SignPer6.SelectedValue = temp.SignDatas[5].SignEmployee.Id;
                this.SignPer7.SelectedValue = temp.SignDatas[6].SignEmployee.Id;
                this.SignPer8.SelectedValue = temp.SignDatas[7].SignEmployee.Id;

                this.Sign1Level.SelectedItem = temp.SignDatas[0].SignLevel.ToString();
                this.Sign2Level.SelectedItem = temp.SignDatas[1].SignLevel.ToString();
                this.Sign3Level.SelectedItem = temp.SignDatas[2].SignLevel.ToString();
                this.Sign4Level.SelectedItem = temp.SignDatas[3].SignLevel.ToString();
                this.Sign5Level.SelectedItem = temp.SignDatas[4].SignLevel.ToString();
                this.Sign6Level.SelectedItem = temp.SignDatas[5].SignLevel.ToString();
                this.Sign7Level.SelectedItem = temp.SignDatas[6].SignLevel.ToString();
                this.Sign8Level.SelectedItem = temp.SignDatas[7].SignLevel.ToString();

                this.View1.SelectedIndex = temp.SignDatas[0].CanView;
                this.View2.SelectedIndex = temp.SignDatas[1].CanView;
                this.View3.SelectedIndex = temp.SignDatas[2].CanView;
                this.View4.SelectedIndex = temp.SignDatas[3].CanView;
                this.View5.SelectedIndex = temp.SignDatas[4].CanView;
                this.View6.SelectedIndex = temp.SignDatas[5].CanView;
                this.View7.SelectedIndex = temp.SignDatas[6].CanView;
                this.View8.SelectedIndex = temp.SignDatas[7].CanView;

                this.Download1.SelectedIndex = temp.SignDatas[0].CanDownload;
                this.Download2.SelectedIndex = temp.SignDatas[1].CanDownload;
                this.Download3.SelectedIndex = temp.SignDatas[2].CanDownload;
                this.Download4.SelectedIndex = temp.SignDatas[3].CanDownload;
                this.Download5.SelectedIndex = temp.SignDatas[4].CanDownload;
                this.Download6.SelectedIndex = temp.SignDatas[5].CanDownload;
                this.Download7.SelectedIndex = temp.SignDatas[6].CanDownload;
                this.Download8.SelectedIndex = temp.SignDatas[7].CanDownload;
            }
            catch
            {
                MessageBox.Show("加载数据失败!");
                Logging.AddLog("修改模板时加载模板信息失败!");

                // 重启应用程序
                if (MessageBox.Show("好吧,我们的程序出现点问题需要重新启动\n点击\"确定\"重启\n点击\"取消\"退出程序?",
                                    "提示",
                                    MessageBoxButtons.OKCancel,
                                    MessageBoxIcon.Question) == DialogResult.OK)
                {
                    Application.Restart();
                }
                else
                {
                    Application.Exit();
                }
            }
        }
예제 #4
0
        public SubmintContempInside(int contempId, SignSocketClient sc, int type)
            : this()
        {
            _sc = sc;
            //模版id
            ContempId = contempId;
            _type     = type;
            try
            {
                // Templete temp = new Templete();
                //SOCKET查询
                temp = _sc.GetContractTemplateInside(ContempId);

                if (temp != null)
                {
                    UserHelper.SelectedTemp = temp;
                }


                this.ConTempName.Text = temp.Name.ToString();
                this.Column1.Text     = temp.ColumnNames[0].ToString();
                this.Column2.Text     = temp.ColumnNames[1].ToString();
                this.Column3.Text     = temp.ColumnNames[2].ToString();
                this.Column4.Text     = temp.ColumnNames[3].ToString();
                this.Column5.Text     = temp.ColumnNames[4].ToString();
                this.Column6.Text     = temp.ColumnNames[5].ToString();

                this.Sign1.Text = temp.SignDatas[0].SignInfo.ToString();
                this.Sign2.Text = temp.SignDatas[1].SignInfo.ToString();
                this.Sign3.Text = temp.SignDatas[2].SignInfo.ToString();
                this.Sign4.Text = temp.SignDatas[3].SignInfo.ToString();
                this.Sign5.Text = temp.SignDatas[4].SignInfo.ToString();
                this.Sign6.Text = temp.SignDatas[5].SignInfo.ToString();
                this.Sign7.Text = temp.SignDatas[6].SignInfo.ToString();
                this.Sign8.Text = temp.SignDatas[7].SignInfo.ToString();


                this.SignPer1.Text = temp.SignDatas[0].SignEmployee.Name.ToString();
                this.SignPer2.Text = temp.SignDatas[1].SignEmployee.Name.ToString();
                this.SignPer3.Text = temp.SignDatas[2].SignEmployee.Name.ToString();
                this.SignPer4.Text = temp.SignDatas[3].SignEmployee.Name.ToString();
                this.SignPer5.Text = temp.SignDatas[4].SignEmployee.Name.ToString();
                this.SignPer6.Text = temp.SignDatas[5].SignEmployee.Name.ToString();
                this.SignPer7.Text = temp.SignDatas[6].SignEmployee.Name.ToString();
                this.SignPer8.Text = temp.SignDatas[7].SignEmployee.Name.ToString();

                if (_type == 10)
                {
                    this.SignPer4.Text = "无需签字";
                }
            }
            catch
            {
                MessageBox.Show("加载数据失败!");
                Logging.AddLog("提交界河专项模板详细信息失败!");

                if (MessageBox.Show("好吧,我们的程序出现点问题需要重新启动\n点击\"确定\"重启\n点击\"取消\"退出程序?",
                                    "提示",
                                    MessageBoxButtons.OKCancel,
                                    MessageBoxIcon.Question) == DialogResult.OK)
                {
                    Application.Restart();
                }
                else
                {
                    Application.Exit();
                }
            }
        }