예제 #1
0
        private PdfPTable StartPageSet(OrgInfo o)
        {
            var t = new PdfPTable(HeaderWids);

            t.HeaderRows = 1;
            t.DefaultCell.SetLeading(2.0f, 1f);
            t.DefaultCell.Border  = PdfPCell.NO_BORDER;
            t.WidthPercentage     = 100;
            t.DefaultCell.Padding = 5;
            pageEvents.StartPageSet($"{o.Division}: {o.Name}, {o.Location} ({o.Teacher})");

            t.AddCell(new Phrase("\nName", boldfont));
            t.AddCell(new Phrase("\nContact Info", boldfont));
            t.AddCell(new Phrase("\nChurch", boldfont));
            t.AddCell(new Phrase("Member\nType", boldfont));
            t.AddCell(new Phrase("\nAllergies", boldfont));
            return(t);
        }
예제 #2
0
        private NetworkConfig(JObject jsonConfig)
        {
            this.jsonConfig = jsonConfig;

            // Extract the main details
            string configName = jsonConfig["name"]?.Value <string>();

            if (string.IsNullOrEmpty(configName))
            {
                throw new ArgumentException("Network config must have a name");
            }

            string configVersion = jsonConfig["version"]?.Value <string>();

            if (string.IsNullOrEmpty(configVersion))
            {
                throw new ArgumentException("Network config must have a version");
                // TODO: Validate the version
            }

            // Preload and create all peers, orderers, etc
            CreateAllPeers();
            CreateAllOrderers();

            Dictionary <string, JToken> foundCertificateAuthorities = FindCertificateAuthorities();

            //createAllCertificateAuthorities();
            CreateAllOrganizations(foundCertificateAuthorities);

            // Validate the organization for this client
            JToken jsonClient = jsonConfig["client"];
            string orgName    = jsonClient == null ? null : jsonClient["organization"]?.Value <string>();

            if (string.IsNullOrEmpty(orgName))
            {
                throw new ArgumentException("A client organization must be specified");
            }

            clientOrganization = GetOrganizationInfo(orgName);
            if (clientOrganization == null)
            {
                throw new ArgumentException("Client organization " + orgName + " is not defined");
            }
        }
        public void QueryNewestVersionWithParams(OrgInfo orgInfo)
        {
            Mock <HttpMessageHandler> handlerMock = new Mock <HttpMessageHandler>(MockBehavior.Strict);

            handlerMock.Protected().As <IHttpMessageHandlerProtectedMembers>()
            .Setup(m => m.SendAsync(It.Is <HttpRequestMessage>(request => this.UriMatches(request.RequestUri, this.baseUrl, orgInfo.OrgName, $"{orgInfo.Platform}-scalar", orgInfo.Ring)), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(this.ConstructResponseContent(orgInfo.Version))
            });

            HttpClient httpClient = new HttpClient(handlerMock.Object);

            OrgInfoApiClient upgradeChecker = new OrgInfoApiClient(httpClient, this.baseUrl);
            Version          version        = upgradeChecker.QueryNewestVersion(orgInfo.OrgName, orgInfo.Platform, orgInfo.Ring);

            version.ShouldEqual(new Version(orgInfo.Version));

            handlerMock.VerifyAll();
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            OrgInfo obj = new OrgInfo()
            {
                Address    = "",
                CreateDt   = DateTime.Now,
                Id         = 0,
                IsDel      = 0,
                ManageName = textBoxManagerName.Text,
                ManageTel  = textBoxTel.Text,
                Name       = textBoxName.Text,
                UpdateDt   = DateTime.Now
            };
            string strMsg;

            if (!GlareLedSysBll.OrgBll.AddAOrg(ref obj, out strMsg))
            {
                MessageBox.Show(strMsg);
                DialogResult = DialogResult.Cancel;
            }
        }
예제 #5
0
        private void button4_Click(object sender, EventArgs e)
        {
            MessageInfo msg  = new MessageInfo();
            SenderInfo  send = new SenderInfo();

            send.MachineCode = "cpu";
            send.ProgramName = "驾校管理软件";
            send.Version     = "5.0.0.6";
            OrgInfo org = new OrgInfo();

            org.FullName   = "济南泰安国际股份有限驾校";
            org.NickName   = "泰安驾校";
            org.Telephone  = "tel";
            org.Url        = "url";
            msg.ObjectType = (typeof(Fm.Driver.StudentInfo)).ToString();
            msg.Version    = "1.0";
            msg.Sender     = send;
            msg.Org        = org;
            msg.Data       = "data";

            this.textBox1.Text = SerializeHelper.SerializeToXml(msg);
        }
        public static OrgInfo getOrgInfo(OrgChart manager, OrgChart reportOne, OrgChart reportTwo)
        {
            int numImportantReports = 0;

            foreach (OrgChart directReport in manager.directReports)
            {
                OrgInfo orgInfo = getOrgInfo(directReport, reportOne, reportTwo);
                if (orgInfo.lowestCommonManager != null)
                {
                    return(orgInfo);
                }
                numImportantReports += orgInfo.numImportantReports;
            }
            if (manager == reportOne || manager == reportTwo)
            {
                numImportantReports++;
            }
            OrgChart lowestCommonManager = numImportantReports == 2 ? manager : null;
            OrgInfo  newOrgInfo          = new OrgInfo(lowestCommonManager, numImportantReports);

            return(newOrgInfo);
        }
예제 #7
0
        public async Task AddOrgInfo(CreateOrgDto input)
        {
            var parentOrgInfo = _repository.Get(input.ParentId);

            OrgInfo tempOrg = new OrgInfo();

            tempOrg.CreateTime = DateTime.Now;
            tempOrg.AliasName  = input.AliasName;
            tempOrg.FullName   = parentOrgInfo.FullName + input.OrgName;
            tempOrg.OrgName    = input.OrgName;
            tempOrg.IsUse      = true;
            tempOrg.Layer      = parentOrgInfo.Layer + 1;
            tempOrg.FatherCode = parentOrgInfo.Code;

            // 获取本层级最大code
            var maxOrgInfo = _repository.GetAll().Where(x => x.FatherCode == parentOrgInfo.Code).OrderByDescending(x => x.Code).FirstOrDefault();
            // 获取本层级最大orderNo
            var maxOrderNo = _repository.GetAll().Where(x => x.FatherCode == parentOrgInfo.Code).OrderByDescending(x => x.OrderNo).FirstOrDefault();

            if (maxOrgInfo != null)
            {
                tempOrg.Code = GetMaxCode(maxOrgInfo.Code);
            }
            else
            {
                tempOrg.Code = parentOrgInfo.Code + "0001";
            }
            // 最大排序号
            if (maxOrderNo != null)
            {
                tempOrg.OrderNo = maxOrderNo.OrderNo + 1;
            }
            else
            {
                tempOrg.OrderNo = 1;
            }

            await _repository.InsertAsync(tempOrg);
        }
예제 #8
0
        // 递归获取所有子结点
        private List <OrgTreeNodeDto> GetTreeNodeListByParent(OrgInfo parent, List <OrgInfo> orgList)
        {
            var childrenList = orgList.Where(x => x.FatherCode == parent.Code).ToList();

            if (childrenList.Count() == 0)
            {
                return(null);
            }

            List <OrgTreeNodeDto> nodeList = new List <OrgTreeNodeDto>();

            foreach (var item in childrenList)
            {
                OrgTreeNodeDto tempNode = new OrgTreeNodeDto()
                {
                    id    = item.Id.ToString(),
                    key   = item.Code,
                    title = item.AliasName,
                };

                List <OrgTreeNodeDto> childNodeList = GetTreeNodeListByParent(item, orgList);
                if (childNodeList == null)
                {
                    tempNode.expanded = false;
                    tempNode.isLeaf   = true;
                }
                else
                {
                    bool isExpanded = item.Layer >= 3 ? false : true;
                    tempNode.expanded = isExpanded;
                    tempNode.isLeaf   = false;
                    tempNode.children = childNodeList;
                }
                nodeList.Add(tempNode);
            }

            return(nodeList);
        }
예제 #9
0
        public ActionResult CreateOrg(OrgInfo org)
        {
            try
            {
                if (!this.ModelState.IsValid)
                {
                    return(View("CreateOrg", org));
                }
                else
                {
                    //Create org and tasks in database

                    //Automapper is the a utility that converts on object to another.
                    //In this case it creates OrgEntity useng instanc eof OrgInfo class.
                    //You just have to make sure that the properties of the both classes are named same.
                    var dbOrg = AutoMapper.Mapper.Map <OrgEntity>(org);


                    dbOrg.TenantId = Guid.NewGuid().ToString();   //This is a  id created to identify the org in the database.
                                                                  //This would be the we use to idenify the org ourside the system (web app) for e.g
                                                                  //int he query string or fields that is visible to user, for security reasong.
                    //Saves data to database and returns the numeric id that is generated
                    var orgId = DB.CreateOrg(dbOrg);

                    //Also create the tasks that need to be fullfilled, in database that are ater processed

                    CreatTasks(orgId);

                    //Renders the view that list the status of the tasks
                    return(View("TasksStatus", null, dbOrg.TenantId));
                }
            }
            catch (Exception ex)
            {
                WriteError(ex);
                return(View("Error"));
            }
        }
예제 #10
0
        public static bool AddAOrg(ref OrgInfo model, out string strErrInfo)
        {
            strErrInfo = "";
            if (IsNameExist(model.Name))
            {
                strErrInfo = ConstDefineBll.NameExist;
                return(false);
            }

            using (GLedDbEntities ent = new GLedDbEntities())
            {
                OrgInfo newModel = new OrgInfo()
                {
                    Id         = 0,
                    Name       = model.Name,
                    ManageName = model.ManageName,
                    ManageTel  = model.ManageTel,
                    Address    = model.Address,
                    CreateDt   = DateTime.Now,
                    UpdateDt   = DateTime.Now
                };

                try
                {
                    ent.OrgInfo.Add(newModel);
                    ent.SaveChanges();
                    model.Id = newModel.Id;
                    return(true);
                }
                catch (System.Exception ex)
                {
                    LogMgr.WriteErrorDefSys("Add Org Ex:" + ex.Message);
                }

                return(true);
            }
        }
        public string AddNewOrg(string strParams)
        {
            string             strError;
            RequestModelString reqinfo = ServerHlper.GetRequestModelString(System.Reflection.MethodBase.GetCurrentMethod().Name,
                                                                           strParams, out strError);

            if (reqinfo == null)
            {
                return(strError);
            }

            OrgInfo mod = JsonStrObjConver.JsonStr2Obj(reqinfo.Info, typeof(OrgInfo))
                          as OrgInfo;

            if (mod == null)
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.HttpParamError));
            }

            bool bResult = OrgBll.AddAOrg(ref mod, out strError);

            if (!bResult)
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.LoginNameOrPassword));
            }

            // 成功返回成功标志及新增加的ID
            JsonResutlModelString result = new JsonResutlModelString()
            {
                ErrorDesc = "success",
                Info      = mod.Id.ToString(),
                Status    = true,
                StatusInt = 1
            };

            return(JsonStrObjConver.Obj2JsonStr(result, typeof(JsonResutlModelString)));
        }
예제 #12
0
        private void DoHeaderFooterParagraphReplacments(Paragraph p, OrgInfo o)
        {
            var list = EmailReplacements.TextReplacementsList(p.Text);

            foreach (var code in list)
            {
                if (code.StartsWith("{datemeeting"))
                {
                    p.ReplaceText(code,
                                  Util.PickFirst(EmailReplacements
                                                 .DateFormattedReplacement(NewMeetingInfo.MeetingDate, code)
                                                 , "____"));
                }
                else if (code == "{orgname}")
                {
                    p.ReplaceText(code, o.Name);
                }
                else if (code == "{today}")
                {
                    p.ReplaceText(code, DateTime.Today.ToShortDateString());
                }
                else if (code == "{orgid}")
                {
                    p.ReplaceText(code, o.OrgId.ToString());
                }
                else if (code == "{barcodemeeting}")
                {
                    var text = $"M.{o.OrgId}.{NewMeetingInfo.MeetingDate:MMddyyHHmm}";
                    var s    = BarCodeStream(text, 50, showtext: false);
                    var img  = curr.AddImage(s);
                    p.AppendPicture(img.CreatePicture());
                    p.ReplaceText(code, "");
                    p.Alignment = Alignment.right;
                }
            }
        }
예제 #13
0
        public ActionResult Modify(GlareSysEfDbAndModels.OrgInfo subject)
        {
            ResultHelper objResult = null;

            try
            {
                using (LedDb db = new LedDb())
                {
                    if (ModelState.IsValid)
                    {
                        OrgInfo aSubject = db.OrgInfo.Where(p => p.Id == subject.Id).FirstOrDefault();
                        aSubject.Name       = subject.Name;
                        aSubject.ManageName = subject.ManageName;
                        aSubject.Address    = subject.Address;
                        aSubject.ManageTel  = subject.ManageTel;
                        aSubject.UpdateDt   = DateTime.Now;
                        string strMsg = string.Empty;
                        bool   b      = OrgBll.UpdateProejct(ref subject, out strMsg);
                        if (b)
                        {
                            objResult = new ResultHelper()
                            {
                                Status = true,
                                Ret    = 0,
                                Obj    = subject,
                                Msg    = strMsg,
                                Desc   = strMsg
                            };
                        }
                        else
                        {
                            objResult = new ResultHelper()
                            {
                                Desc   = strMsg,
                                Msg    = strMsg,
                                Obj    = null,
                                Ret    = -1,
                                Status = false
                            };
                        }
                        //if (db.SaveChanges() > 0)
                        //{
                        //    objResult = new ResultHelper()
                        //    {
                        //        Status = true,
                        //        Ret = 0,
                        //        Obj = subject,
                        //        Msg = "Edit Success!",
                        //        Desc = "Edit Success!"
                        //    };
                        //}
                        //else
                        //{
                        //    objResult = new ResultHelper()
                        //    {
                        //        Desc = "Edit Faile,please try again.",
                        //        Msg = "Edit Faile,please try again.",
                        //        Obj = null,
                        //        Ret = -1,
                        //        Status = false
                        //    };
                        //}
                    }
                    else
                    {
                        objResult = new ResultHelper()
                        {
                            Desc   = " Faile,please try again",
                            Msg    = " Faile,please try again",
                            Obj    = null,
                            Ret    = -1,
                            Status = false
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                objResult = new ResultHelper()
                {
                    Desc   = ex.Message,
                    Msg    = ex.Message,
                    Obj    = null,
                    Ret    = -1,
                    Status = false
                };
            }
            return(Json(objResult));
        }
예제 #14
0
        private PdfPTable StartPageSet(OrgInfo o)
        {
            var t = new PdfPTable(HeaderWids);
            t.HeaderRows = 1;
            t.DefaultCell.SetLeading(2.0f, 1f);
            t.DefaultCell.Border = PdfPCell.NO_BORDER;
            t.WidthPercentage = 100;
            t.DefaultCell.Padding = 5;
            pageEvents.StartPageSet($"Class List: {o.Division} - {o.Name} ({o.Teacher})");

            t.AddCell(new Phrase("Name\nAddress", boldfont));
            t.AddCell(new Phrase("Phones\nEmail", boldfont));
            t.AddCell(new Phrase("\nMember Type", boldfont));
            return t;
        }
예제 #15
0
 private void StartPageSet(OrgInfo o)
 {
     doc.NewPage();
     pageSetStarted = true;
     //            if (altnames == true)
     //            {
     //                BaseFont.AddToResourceSearch(HttpContext.Current.Server.MapPath("/iTextAsian.dll"));
     //                var bfchina = BaseFont.CreateFont("MHei-Medium",
     //                    "UniCNS-UCS2-H", BaseFont.EMBEDDED);
     //                china = new Font(bfchina, 12, Font.NORMAL);
     //            }
     pageEvents.StartPageSet(
                             "{0}: {1}, {2} ({3})".Fmt(o.Division, o.Name, o.Location, o.Teacher),
                             "{0:f} ({1})".Fmt(dt, o.OrgId),
                             "M.{0}.{1:MMddyyHHmm}".Fmt(o.OrgId, dt));
 }
예제 #16
0
        private PdfPTable StartPageSet(OrgInfo o)
        {
            var t = new PdfPTable(HeaderWids);
            t.HeaderRows = 1;
            t.DefaultCell.SetLeading(2.0f, 1f);
            t.DefaultCell.Border = PdfPCell.NO_BORDER;
            t.WidthPercentage = 100;
            t.DefaultCell.Padding = 5;
            pageEvents.StartPageSet($"{o.Division}: {o.Name}, {o.Location} ({o.Teacher})");

            t.AddCell(new Phrase("\nName", boldfont));
            t.AddCell(new Phrase("\nContact Info", boldfont));
            t.AddCell(new Phrase("\nChurch", boldfont));
            t.AddCell(new Phrase("Member\nType", boldfont));
            t.AddCell(new Phrase("\nMedical", boldfont));
            return t;
        }
예제 #17
0
 private PdfPTable StartPageSet(OrgInfo o)
 {
     t = new PdfPTable(5);
     t.WidthPercentage = 100;
     t.SetWidths(new int[] { 40, 2, 5, 20, 30 });
     t.DefaultCell.Border = PdfPCell.NO_BORDER;
     pageEvents.StartPageSet(
                             "{0}: {1}, {2} ({3})".Fmt(o.Division, o.Name, o.Location, o.Teacher),
                             "{0:f} ({1})".Fmt(dt, o.OrgId),
                             "M.{0}.{1:MMddyyHHmm}".Fmt(o.OrgId, dt));
     return t;
 }
예제 #18
0
 public string CreateDepartment(OrgInfo Org)
 {
     return(_IDepartment.AddDepartment(Org.Name, Org.Key));
 }
예제 #19
0
 void selectorg_reforginfoevent(string loginname, string username, OrgInfo org)
 {
     AddRowToList(loginname, username);
 }
예제 #20
0
    public CascadingDropDownNameValue[] Util_GetCompDeptUser(string knownCategoryValues, string category, string contextKey)
    {
        //拆解 CategoryValues
        StringDictionary dicCategory = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
        StringDictionary dicContext  = CascadingDropDown.ParseKnownCategoryValuesString(contextKey);

        //資料改從 OrgInfo / UserInfo 的方法取得 2016.11.02
        bool IsChkValid = true;

        string[]  ValidKeyList = null;
        DataTable dt           = null;

        //判斷要處理那一階選單
        switch (category)
        {
        case "CompID":
            IsChkValid   = (dicContext["IsChkValid"].ToString().ToUpper() == "Y") ? true : false;
            ValidKeyList = (!string.IsNullOrEmpty(dicContext["ValidKeyList"])) ? dicContext["ValidKeyList"].Split(',') : null;
            if (dicContext["IsReadOnly"].ToString().ToUpper() == "Y")
            {
                ValidKeyList = dicContext["SelectedValue"].Split(',');     //若為「唯讀」,自動限定資料為目前的 SelectedValue
            }

            dt = Util.getDataTable(OrgInfo.getOrgDictionary(true, false, false, IsChkValid, ValidKeyList));
            if (!dt.IsNullOrEmpty())
            {
                dt.Columns.Remove("Value");
            }

            break;

        case "DeptID":
            IsChkValid   = (dicContext["IsChkValid"].ToString().ToUpper() == "Y") ? true : false;
            ValidKeyList = (!string.IsNullOrEmpty(dicContext["ValidKeyList"])) ? dicContext["ValidKeyList"].Split(',') : null;
            if (dicContext["IsReadOnly"].ToString().ToUpper() == "Y")
            {
                ValidKeyList = dicContext["SelectedValue"].Split(',');     //若為「唯讀」,自動限定資料為目前的 SelectedValue
            }

            dt = Util.getDataTable(OrgInfo.getOrgDictionary(false, true, false, IsChkValid, dicCategory["CompID"].Split(','), ValidKeyList));
            if (!dt.IsNullOrEmpty())
            {
                dt.Columns.Remove("Value");
            }

            break;

        case "OrganID":
            IsChkValid   = (dicContext["IsChkValid"].ToString().ToUpper() == "Y") ? true : false;
            ValidKeyList = (!string.IsNullOrEmpty(dicContext["ValidKeyList"])) ? dicContext["ValidKeyList"].Split(',') : null;
            if (dicContext["IsReadOnly"].ToString().ToUpper() == "Y")
            {
                ValidKeyList = dicContext["SelectedValue"].Split(',');     //若為「唯讀」,自動限定資料為目前的 SelectedValue
            }

            dt = Util.getDataTable(OrgInfo.getOrgDictionary(false, false, true, IsChkValid, dicCategory["CompID"].Split(','), dicCategory["DeptID"].Split(','), ValidKeyList));
            if (!dt.IsNullOrEmpty())
            {
                dt.Columns.Remove("Value");
            }

            break;

        case "UserID":
            IsChkValid   = (dicContext["IsChkValid"].ToString().ToUpper() == "Y") ? true : false;
            ValidKeyList = (!string.IsNullOrEmpty(dicContext["ValidKeyList"])) ? dicContext["ValidKeyList"].Split(',') : null;
            if (dicContext["IsReadOnly"].ToString().ToUpper() == "Y")
            {
                ValidKeyList = dicContext["SelectedValue"].Split(',');     //若為「唯讀」,自動限定資料為目前的 SelectedValue
            }

            dt = UserInfo.getUserData(dicCategory["CompID"], dicCategory["DeptID"], dicCategory["OrganID"], IsChkValid);
            if (ValidKeyList != null && ValidKeyList.Length > 0)
            {
                DataRow[] oRows = dt.Select(string.Format(" UserID in ('{0}') ", Util.getStringJoin(ValidKeyList, "','")));
                if (oRows != null || oRows.Count() > 0)
                {
                    dt = oRows.CopyToDataTable();
                }
            }

            if (!dt.IsNullOrEmpty())
            {
                dt = dt.DefaultView.ToTable(true, "UserID,UserName".Split(','));     //可能包含兼職資料,預防 UserID 發生重複
                dt = Util.getDataTable(Util.getDictionary(dt));
                dt.Columns.Remove("Value");
            }

            break;

        default:
            break;
        }
        return(Util.getCascadingArray(dt));
    }
예제 #21
0
        public static async Task <Result> ReceiptOCR(string Id)
        {
            try
            {
                var ApplyPointModel = dal.GetModel <ApplyPoint>($"and ApplyPointID='{Id}'");        //根据Id 获取 积分申请
                if (ApplyPointModel == null)
                {
                    return(new Result(false, "积分申请表查无数据", null));
                }

                var ReceiptOCRResult = await Task.Run(async() =>
                {
                    #region 调用BAIDUOCR API,并将识别数据添加至原始数据表

                    var Image  = (Bitmap)Bitmap.FromFile(ApplyPointModel.ReceiptPhoto);
                    var base64 = Commom.ImgToBase64String(Image);        //拿到积分申请中的图片转为Base64
                    base64     = System.Web.HttpUtility.UrlEncode(base64);
                    //byte[] bytes = Convert.FromBase64String(base64);
                    //var result = Commom.GeneralOCRBasic(s => s.Receipt(bytes));   //暂时为票据服务识别
                    //根据MallOCRRule配置的OCR相关配置进行OCR请求,暂不用SDK,缓存处理
                    MallOCRRule MallOCRRule = CacheHandle <MallOCRRule>($"MallOCRRule{Id}", 1, $" and MallID='{ApplyPointModel.MallID}'");
                    var result = HttpHelper.HttpPost(string.Format(MallOCRRule.OCRServerURL, MallOCRRule.OCRServerToken), $"image={base64}");
                    if (result.Contains("error_msg"))
                    {
                        var OCRErrorModel = JsonConvert.DeserializeObject <OCRErrorResult>(result);
                        return(new Result(false, OCRErrorModel.error_msg, null));
                    }

                    var RecongnizeModel = new ApplyPictureRecongnize
                    {
                        id          = Guid.NewGuid(),
                        applyid     = Guid.Parse(Id),
                        Lineno      = 0,
                        LineContent = result
                    };
                    var AddResult = DbContext.Add(RecongnizeModel);       //识别内容添加到识别原始表

                    #endregion

                    if (AddResult == 0)
                    {
                        ApplyPointModel.RecongizeStatus = 1;
                        var UpadateResult = DbContext.Update(ApplyPointModel);        //已解析原始数据
                        if (UpadateResult)
                        {
                            //根据商铺规则明细取到OCR结果
                            var ApplyOCRResult = GetApplyPointOCRResult(Guid.Parse(Id), ApplyPointModel.StoreID, result);
                            if (ApplyOCRResult.Success)
                            {
                                ApplyPointOCRResult OCRResult = (ApplyPointOCRResult)ApplyOCRResult.Data;

                                //匹配商铺规则
                                var VerifyResult = VerifyOCRResult(OCRResult);
                                if (VerifyResult.Success)
                                {
                                    //更新积分申请表
                                    ApplyPointModel.RecongizeStatus = 2;            //成功匹配
                                    ApplyPointModel.AuditDate       = DateTime.Now; //修改审批日期
                                    if (DbContext.Update(ApplyPointModel))
                                    {
                                        Store StoreModel = CacheHandle <Store>($"Store{ApplyPointModel.StoreID}", 1, $" and StoreId = '{ApplyPointModel.StoreID}'");
                                        OrgInfo orgInfo  = CacheHandle <OrgInfo>($"OrgInfo{StoreModel.OrgID}", 24, $" and OrgId = '{StoreModel.OrgID}'");
                                        Company company  = CacheHandle <Company>($"Company{StoreModel.CompanyID}", 24, $" and CompanyId = '{StoreModel.CompanyID}'");

                                        Card card = dal.GetModel <Card>($" and CardID = '{ApplyPointModel.CardID}'");
                                        //自动积分
                                        var webPosArg = new WebPosArg
                                        {
                                            cardID             = card.CardCode,
                                            companyID          = company.CompanyCode,
                                            orgID              = orgInfo.OrgCode,
                                            storeID            = StoreModel.StoreCode,
                                            cashierID          = "crm",
                                            discountPercentage = 0,
                                            receiptNo          = ApplyPointModel.ReceiptNo,
                                            txnDateTime        = ApplyPointModel.TransDate
                                        };
                                        var webPosResult = await WebPosForPoint(webPosArg);
                                        return(webPosResult);
                                    }
                                    else
                                    {
                                        return(new Result(false, "OCR信息校验成功后修改积分申请表失败", null));
                                    }
                                }
                                else
                                {
                                    return(new Result(false, VerifyResult.Message, null));
                                }
                            }
                            else
                            {
                                ApplyPointModel.RecongizeStatus = 3;  //成功匹配
                                DbContext.Update(ApplyPointModel);
                                return(new Result(false, ApplyOCRResult.Message, null));
                            }
                        }
                        else
                        {
                            return(new Result(false, "修改积分申请表失败", null));
                        }
                    }
                    else
                    {
                        return(new Result(false, "添加到原始表失败", null));
                    }
                });

                return(ReceiptOCRResult);
            }
            catch (Exception ex)
            {
                Log.Error("ReceiptOCR", ex);
                return(new Result(false, ex.Message, null));
            }
        }
예제 #22
0
        private void button4_Click(object sender, EventArgs e)
        {
            MessageInfo msg = new MessageInfo();
            SenderInfo send = new SenderInfo();
            send.MachineCode = "cpu";
            send.ProgramName = "���������";
            send.Version = "5.0.0.6";
            OrgInfo org=new OrgInfo();
            org.FullName = "����̩�����ʹɷ����޼�У";
            org.NickName = "̩����У";
            org.Telephone = "tel";
            org.Url = "url";
            msg.ObjectType = (typeof(Fm.Driver.StudentInfo)).ToString();
            msg.Version = "1.0";
            msg.Sender = send;
            msg.Org = org;
            msg.Data = "data";

            this.textBox1.Text = SerializeHelper.SerializeToXml(msg);
        }
예제 #23
0
 private PdfPTable StartPageSet(OrgInfo o)
 {
     t = new PdfPTable(5);
     t.WidthPercentage = 100;
     t.SetWidths(new int[] { 40, 2, 5, 20, 30 });
     t.DefaultCell.Border = PdfPCell.NO_BORDER;
     pageEvents.StartPageSet(
         $"{o.Division}: {o.Name}, {o.Location} ({o.Teacher})",
         $"{NewMeetingInfo.MeetingDate:f} ({o.OrgId})",
         $"M.{o.OrgId}.{NewMeetingInfo.MeetingDate:MMddyyHHmm}");
     return t;
 }
예제 #24
0
 private void StartPageSet(OrgInfo o)
 {
     doc.NewPage();
     pageSetStarted = true;
     if (NewMeetingInfo.UseAltNames)
         china = CreateChineseFont();
     pageEvents.StartPageSet(
         $"{o.Division}: {o.Name}, {o.Location} ({o.Teacher})",
         $"{NewMeetingInfo.MeetingDate:f} ({o.OrgId})",
         $"M.{o.OrgId}.{NewMeetingInfo.MeetingDate:MMddyyHHmm}");
 }
예제 #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Chche List
        labCacheList.Text = string.Format("快取清單:<br><ul><li>{0}</ul>", Util.getStringJoin(CacheHelper.getCacheList(), "<li>"));

        //設定 ucPageInfo1
        ucPageInfo1.ucIsShowApplication     = true;
        ucPageInfo1.ucIsShowEnvironmentInfo = true;
        ucPageInfo1.ucIsShowQueryString     = false;
        ucPageInfo1.ucIsShowRequestForm     = false;
        ucPageInfo1.ucIsShowSession         = true;

        //設定 TinyMCE
        //預設MCE
        Util.setJS_TinyMCE(txtMCE.ID);
        btnMCEClear.OnClientClick = string.Format("document.getElementById('{0}').innerHTML = '';return false;", txtMCEResult.ClientID);
        //自訂MCE
        string strCustToolList1 = "newdocument undo redo | fontsizeselect bold italic underline | bullist numlist outdent indent";
        string strCustToolList2 = "cut copy paste pastetext | alignleft aligncenter alignright | forecolor backcolor removeformat | table link";

        Util.setJS_TinyMCE(txtCustMCE.ID, 500, 150, false, strCustToolList1, strCustToolList2);
        btnCustMCEClear.OnClientClick = string.Format("document.getElementById('{0}').innerHTML = '';return false;", txtCustMCEResult.ClientID);

        //設定可繞過Valid檢查的相關物件
        ArrayList arBypassList = new ArrayList();

        arBypassList.Add(txtMCE.ID);
        arBypassList.Add(txtMCEResult.ID);
        arBypassList.Add(txtCustMCE.ID);
        arBypassList.Add(txtCustMCEResult.ID);

        arBypassList.Add(txtMailFrom.ID);
        arBypassList.Add(txtMailTo.ID);
        arBypassList.Add(txtMailCC.ID);
        arBypassList.Add(txtMailBCC.ID);

        arBypassList.Add(txtMailFrom2.ID);
        arBypassList.Add(txtMailTo2.ID);
        arBypassList.Add(txtMailCC2.ID);
        arBypassList.Add(txtMailBCC2.ID);

        Util.setRequestValidatorBypassIDList(Util.getStringJoin(arBypassList));

        //Upload相關
        ucUploadButton1.ucBtnWidth          = 100;
        ucUploadButton1.ucBtnCaption        = "上傳(對話框)";
        ucUploadButton1.ucPopupHeader       = "匯入作業";
        ucUploadButton1.ucUploadFileExtList = "xls,xlsx";
        ucUploadButton1.onClose            += new Util_ucUploadButton.Close(ucUploadButton1_onClose);

        //2015.06.24 新增
        ucUploadButton2.ucBtnWidth          = 100;
        ucUploadButton2.ucBtnCaption        = "上傳(新視窗)";
        ucUploadButton2.ucPopupHeader       = "匯入作業";
        ucUploadButton2.ucUploadFileExtList = "xls,xlsx";
        ucUploadButton2.ucIsPopNewWindow    = true;
        ucUploadButton2.onClose            += ucUploadButton2_onClose;


        //附檔相關
        ucAttachAdminButton1.ucBtnWidth          = 100;
        ucAttachAdminButton1.ucBtnCaption        = "管理(對話框)";
        ucAttachAdminButton1.ucAttachDB          = txtAttachDB.Text;
        ucAttachAdminButton1.ucAttachID          = txtAttachID.Text;
        ucAttachAdminButton1.ucAttachFileMaxQty  = int.Parse("0" + txtAttachFileMaxQty.Text);
        ucAttachAdminButton1.ucAttachFileMaxKB   = int.Parse("0" + txtAttachFileMaxKB.Text);
        ucAttachAdminButton1.ucAttachFileTotKB   = int.Parse("0" + txtAttachFileTotKB.Text);
        ucAttachAdminButton1.ucAnonymousYN       = ddlAnonymousYN.SelectedValue;
        ucAttachAdminButton1.ucAttachFileExtList = txtAttachFileExtList.Text;

        ucAttachAdminButton2.ucBtnWidth          = 100;
        ucAttachAdminButton2.ucBtnCaption        = "管理(新視窗)";
        ucAttachAdminButton2.ucIsPopNewWindow    = true;
        ucAttachAdminButton2.ucAttachDB          = txtAttachDB.Text;
        ucAttachAdminButton2.ucAttachID          = txtAttachID.Text;
        ucAttachAdminButton2.ucAttachFileMaxQty  = int.Parse("0" + txtAttachFileMaxQty.Text);
        ucAttachAdminButton2.ucAttachFileMaxKB   = int.Parse("0" + txtAttachFileMaxKB.Text);
        ucAttachAdminButton2.ucAttachFileTotKB   = int.Parse("0" + txtAttachFileTotKB.Text);
        ucAttachAdminButton2.ucAnonymousYN       = ddlAnonymousYN.SelectedValue;
        ucAttachAdminButton2.ucAttachFileExtList = txtAttachFileExtList.Text;

        ucAttachDownloadButton1.ucBtnWidth   = 100;
        ucAttachDownloadButton1.ucBtnCaption = "清單(對話框)";
        ucAttachDownloadButton1.ucAttachDB   = txtAttachDB.Text;
        ucAttachDownloadButton1.ucAttachID   = txtAttachID.Text;

        ucAttachDownloadButton2.ucBtnWidth       = 100;
        ucAttachDownloadButton2.ucBtnCaption     = "清單(新視窗)";
        ucAttachDownloadButton2.ucIsPopNewWindow = true;
        ucAttachDownloadButton2.ucAttachDB       = txtAttachDB.Text;
        ucAttachDownloadButton2.ucAttachID       = txtAttachID.Text;

        //設定單選的「候選清單」
        ucCommSingleSelect1.ucSourceDictionary = Util.getDictionary(getSampleData(), 0, 1, true);

        //彈出[複選清單](ucButton)

        ucCommMultiSelectButton1.ucSourceDictionary = OrgInfo.getOrgDictionary(); //2016.07.01 調整
        ucCommMultiSelectButton1.ucSelectedIDListToParentObjClientID   = txtPopupID1.ClientID;
        ucCommMultiSelectButton1.ucSelectedInfoListToParentObjClientID = txtPopupInfo1.ClientID;
        ucCommMultiSelectButton1.ucSelectAllConfirmMsg = "這樣會造成災難,確定?";

        //設定[關聯選單](ucButton)
        ucCommCascadeSelectButton1.ucIsSelectUserYN  = ddlIsSeleUser1.SelectedValue;
        ucCommCascadeSelectButton1.ucIsMultiSelectYN = ddlIsMultiSele1.SelectedValue;
        ucCommCascadeSelectButton1.ucDefCompID       = txtDefComp1.Text;
        ucCommCascadeSelectButton1.ucDefDeptID       = txtDefDept1.Text;
        ucCommCascadeSelectButton1.ucDefUserIDList   = txtDefUser1.Text;
        ucCommCascadeSelectButton1.ucSelectedCompIDToParentObjClientID       = txtComp1.ClientID;
        ucCommCascadeSelectButton1.ucSelectedDeptIDToParentObjClientID       = txtDept1.ClientID;
        ucCommCascadeSelectButton1.ucSelectedUserIDListToParentObjClientID   = txtUser1.ClientID;
        ucCommCascadeSelectButton1.ucSelectedCompInfoToParentObjClientID     = txtCompInfo1.ClientID;
        ucCommCascadeSelectButton1.ucSelectedDeptInfoToParentObjClientID     = txtDeptInfo1.ClientID;
        ucCommCascadeSelectButton1.ucSelectedUserInfoListToParentObjClientID = txtUserInfo1.ClientID;

        //設定Ajax關聯式下拉選單
        ucCascadingDropDown1.SetDefault(); //使用預設設定
        ucCascadingDropDown1.Refresh();

        //訂閱所需的彈出視窗事件,方便關閉視窗後,視需要進行相關後續處理
        ucModalPopup1.onComplete += new Util_ucModalPopup.btnCompleteClick(ucModalPopup1_onComplete);
        ucModalPopup1.onCancel   += new Util_ucModalPopup.btnCancelClick(ucModalPopup1_onCancel);
        ucModalPopup1.onClose    += new Util_ucModalPopup.btnCloseClick(ucModalPopup1_onClose);

        if (!IsPostBack)
        {
            //設定彈出視窗內的頁框來源URL
            txtPopupURL.Text = "";

            //設定 Cust64Key
            txtCust64Seed.Text = Util.getAppSetting("app://CfgCust64Seed/");

            //設定 HtmlMsg Kind
            ddlHtmlMsg.DataSource     = Util.getDictionary(typeof(Util.HtmlMessageKind));
            ddlHtmlMsg.DataTextField  = "value";
            ddlHtmlMsg.DataValueField = "key";
            ddlHtmlMsg.DataBind();

            //設定Mail
            txtMailFrom.Text  = string.Format("{0} < {1} >", Util.getAppSetting("appMailAddrDisplay"), Util.getAppSetting("appMailFrom"));
            txtMailFrom2.Text = string.Format("{0} < {1} >", Util.getAppSetting("appMailAddrDisplay"), Util.getAppSetting("appMailFrom"));
            //txtMailAttach2.Text = "{\"AttachDB\":\"ezFlowAttach\",\"AttachID\":\"eDoc-20130130.00002.00010\",\"SeqNo\":\"1\"}";
            txtMailAttach2.Text = "[{'AttachDB':'ezFlowAttach','AttachID':'eDoc-20130130.00002.00010','SeqNo':'10'}]";
        }
        else
        {
            //顯示 ucCommCascadeSelect1 傳回值
            txtComp2.Text     = ucCommCascadeSelect1.ucSelectedCompID;
            txtDept2.Text     = ucCommCascadeSelect1.ucSelectedDeptID;
            txtUser2.Text     = ucCommCascadeSelect1.ucSelectedUserIDList;
            txtCompInfo2.Text = ucCommCascadeSelect1.ucSelectedCompInfo;
            txtDeptInfo2.Text = ucCommCascadeSelect1.ucSelectedDeptInfo;
            txtUserInfo2.Text = ucCommCascadeSelect1.ucSelectedUserInfoList;
        }
    }
예제 #26
0
 public string CreateOrg(OrgInfo newOrg)
 {
     return("done");
 }
예제 #27
0
 public WayBillInformBRegTypeHeader()
 {
     this.supplierField  = new OrgInfo();
     this.consigneeField = new OrgInfo();
     this.shipperField   = new OrgInfo();
 }
예제 #28
0
        // Creates a new OrgInfo instance from a JSON object
        private OrgInfo CreateOrg(string orgName, JToken jsonOrg, Dictionary <string, JToken> foundCertificateAuthorities)
        {
            string msgPrefix = $"Organization {orgName}";

            string mspId = jsonOrg["mspid"]?.Value <string>();

            OrgInfo org = new OrgInfo(orgName, mspId);

            // Peers
            JArray jsonPeers = jsonOrg["peers"] as JArray;

            if (jsonPeers != null)
            {
                foreach (JToken peer in jsonPeers)
                {
                    string peerName = peer.Value <string>();
                    if (!string.IsNullOrEmpty(peerName))
                    {
                        org.PeerName.Add(peerName);
                    }
                }
            }

            // CAs
            JArray jsonCertificateAuthorities = jsonOrg["certificateAuthorities"] as JArray;

            if (jsonCertificateAuthorities != null)
            {
                foreach (JToken jsonCA in jsonCertificateAuthorities)
                {
                    string caName = jsonCA.Value <string>();

                    if (!string.IsNullOrEmpty(caName))
                    {
                        JToken jsonObject = foundCertificateAuthorities[caName];
                        if (jsonObject != null)
                        {
                            org.CertificateAuthorities.Add(CreateCA(caName, jsonObject, org));
                        }
                        else
                        {
                            throw new NetworkConfigurationException($"{msgPrefix}: Certificate Authority {caName} is not defined");
                        }
                    }
                }
            }

            string adminPrivateKeyString = ExtractPemString(jsonOrg, "adminPrivateKey", msgPrefix);
            string signedCert            = ExtractPemString(jsonOrg, "signedCert", msgPrefix);

            if (!string.IsNullOrEmpty(adminPrivateKeyString) && !string.IsNullOrEmpty(signedCert))
            {
                KeyPair privateKey;

                try
                {
                    privateKey = KeyPair.Create(adminPrivateKeyString);
                }
                catch (IOException ioe)
                {
                    throw new NetworkConfigurationException($"{msgPrefix}: Invalid private key", ioe);
                }

                try
                {
                    org.PeerAdmin = new UserInfo(Factory.GetCryptoSuite(), mspId, "PeerAdmin_" + mspId + "_" + orgName, null);
                }
                catch (Exception e)
                {
                    throw new NetworkConfigurationException(e.Message, e);
                }

                org.PeerAdmin.Enrollment = new X509Enrollment(privateKey, signedCert);
            }

            return(org);
        }
예제 #29
0
 public void ReName(OrgInfo Org)
 {
     _IDepartment.ReName(Org.Key, Org.Name);
 }
예제 #30
0
 public bool IsAdminUserAvaialbe(OrgInfo newOrg)
 {
     return(IsAdminUserAvaialbe(newOrg));
 }
예제 #31
0
        private void StartPageSet(OrgInfo o)
        {
            t = new PdfPTable(4);
            t.WidthPercentage = 100;
            t.SetWidths(new[] { 15, 30, 15, 40 });
            t.DefaultCell.Border = PdfPCell.NO_BORDER;
            pageEvents.StartPageSet(
                $"{o.Division}: {o.Name}, {o.Location} ({o.Teacher})",
                $"({o.OrgId})");

            var boldfont = FontFactory.GetFont(FontFactory.HELVETICA_BOLD);
            t.AddCell(new Phrase("PeopleId", boldfont));
            t.AddCell(new Phrase("Name", boldfont));
            t.AddCell(new Phrase("Member Type", boldfont));
            t.AddCell(new Phrase("Allergies", boldfont));
            pagesetstarted = true;
        }
예제 #32
0
        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;

            CmsData.Meeting meeting = null;
            if (meetingid.HasValue)
            {
                meeting = DbUtil.Db.Meetings.Single(mt => mt.MeetingId == meetingid);
                dt      = meeting.MeetingDate;
                orgid   = meeting.OrganizationId;
            }

            var list1 = bygroup == true?ReportList2().ToList() : ReportList().ToList();

            if (!list1.Any())
            {
                Response.Write("no data found");
                return;
            }
            if (!dt.HasValue)
            {
                Response.Write("bad date");
                return;
            }
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=foo.pdf");

            doc = new Document(PageSize.LETTER.Rotate(), 36, 36, 64, 64);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);

            w.PageEvent = pageEvents;
            doc.Open();
            dc = w.DirectContent;

            box           = new PdfPCell();
            box.Border    = PdfPCell.NO_BORDER;
            box.CellEvent = new CellEvent();
            PdfPTable table = null;

            OrgInfo lasto = null;

            foreach (var o in list1)
            {
                lasto = o;
                table = new PdfPTable(1);
                table.DefaultCell.Border  = PdfPCell.NO_BORDER;
                table.DefaultCell.Padding = 0;
                table.WidthPercentage     = 100;
                if (meeting != null)
                {
                    var Groups = o.Groups;
                    if (Groups[0] == 0)
                    {
                        var q = from at in meeting.Attends
                                where at.AttendanceFlag == true || at.Commitment == AttendCommitmentCode.Attending || at.Commitment == AttendCommitmentCode.Substitute
                                orderby at.Person.LastName, at.Person.FamilyId, at.Person.Name2
                            select new
                        {
                            at.MemberType.Code,
                            Name2 = (altnames == true && at.Person.AltName != null && at.Person.AltName.Length > 0) ? at.Person.AltName : at.Person.Name2,
                            at.PeopleId,
                            at.Person.DOB,
                        };
                        if (q.Any())
                        {
                            StartPageSet(o);
                        }
                        foreach (var a in q)
                        {
                            table.AddCell(AddRow(a.Code, a.Name2, a.PeopleId, a.DOB, "", font));
                        }
                    }
                    else
                    {
                        var q = from at in meeting.Attends
                                let om =
                            at.Organization.OrganizationMembers.SingleOrDefault(mm => mm.PeopleId == at.PeopleId)
                            let gc = om.OrgMemMemTags.Count(mt => Groups.Contains(mt.MemberTagId))
                                     where gc == Groups.Length || Groups[0] <= 0
                                     where gc > 0
                                     where !Groups.Contains(-1) || (Groups.Contains(-1) && om.OrgMemMemTags.Count() == 0)
                                     where
                                     at.AttendanceFlag == true || at.Commitment == AttendCommitmentCode.Attending ||
                                     at.Commitment == AttendCommitmentCode.Substitute
                                     orderby at.Person.LastName, at.Person.FamilyId, at.Person.Name2
                            select new
                        {
                            at.MemberType.Code,
                            Name2 = (altnames == true && at.Person.AltName != null && at.Person.AltName.Length > 0) ? at.Person.AltName : at.Person.Name2,
                            at.PeopleId,
                            at.Person.DOB,
                        };
                        if (q.Any())
                        {
                            StartPageSet(o);
                        }
                        foreach (var a in q)
                        {
                            table.AddCell(AddRow(a.Code, a.Name2, a.PeopleId, a.DOB, "", font));
                        }
                    }
                }
                else
                {
                    var Groups = o.Groups;
                    if (Groups == null)
                    {
                        Groups = new int[] { 0 }
                    }
                    ;
                    var q = from om in DbUtil.Db.OrganizationMembers
                            where om.OrganizationId == o.OrgId
                            let gc = om.OrgMemMemTags.Count(mt => Groups.Contains(mt.MemberTagId))
                                     where gc == Groups.Length || Groups[0] <= 0
                                     where !Groups.Contains(-1) || (Groups.Contains(-1) && om.OrgMemMemTags.Count() == 0)
                                     where (om.Pending ?? false) == false
                                     where om.MemberTypeId != MemberTypeCode.InActive
                                     where om.MemberTypeId != MemberTypeCode.Prospect
                                     where om.EnrollmentDate <= Util.Now
                                     orderby om.Person.LastName, om.Person.FamilyId, om.Person.Name2
                    let p = om.Person
                            let ch = altnames == true && p.AltName != null && p.AltName.Length > 0
                                     select new
                    {
                        PeopleId  = p.PeopleId,
                        Name2     = ch ? p.AltName : p.Name2,
                        BirthDate = Util.FormatBirthday(
                            p.BirthYear,
                            p.BirthMonth,
                            p.BirthDay),
                        MemberTypeCode = om.MemberType.Code,
                        ch,
                        highlight = om.OrgMemMemTags.Any(mm => mm.MemberTag.Name == highlightsg) ? highlightsg : ""
                    };
                    if (q.Any())
                    {
                        StartPageSet(o);
                    }
                    foreach (var m in q)
                    {
                        table.AddCell(AddRow(m.MemberTypeCode, m.Name2, m.PeopleId, m.BirthDate, m.highlight, m.ch ? china : font));
                    }
                }

                if (bygroup == false && groups[0] == 0 && meeting == null)
                {
                    foreach (var m in RollsheetModel.FetchVisitors(o.OrgId, dt.Value, NoCurrentMembers: true, UseAltNames: altnames == true))
                    {
                        if (table.Rows.Count == 0)
                        {
                            StartPageSet(o);
                        }
                        table.AddCell(AddRow(m.VisitorType, m.Name2, m.PeopleId, m.BirthDate, "", boldfont));
                    }
                }
                if (!pageSetStarted)
                {
                    continue;
                }

                var   col      = 0;
                float gutter   = 20f;
                float colwidth = (doc.Right - doc.Left - gutter) / 2;
                var   ct       = new ColumnText(w.DirectContent);
                ct.AddElement(table);

                int status = 0;

                while (ColumnText.HasMoreText(status))
                {
                    if (col == 0)
                    {
                        ct.SetSimpleColumn(doc.Left, doc.Bottom, doc.Left + colwidth, doc.Top);
                    }
                    else
                    {
                        ct.SetSimpleColumn(doc.Right - colwidth, doc.Bottom, doc.Right, doc.Top);
                    }
                    status = ct.Go();
                    ++col;
                    if (col > 1)
                    {
                        col = 0;
                        doc.NewPage();
                    }
                }

//                foreach (var li in list)
//                {
//                    y = ct.YLine;
//                    ct.AddElement(li);
//                    status = ct.Go(true);
//                    if (ColumnText.HasMoreText(status))
//                    {
//                        ++col;
//                        if (col > 1)
//                        {
//                            col = 0;
//                            doc.NewPage();
//                        }
//                        ct.SetSimpleColumn(cols[col]);
//                        y = doc.Top;
//                    }
//                    ct.YLine = y;
//                    ct.SetText(null);
//                    ct.AddElement(li);
//                    status = ct.Go();
//                }
            }
            if (!hasRows)
            {
                if (!pageSetStarted)
                {
                    StartPageSet(lasto);
                }
                doc.Add(new Paragraph("no members as of this meeting date and time to show on rollsheet"));
            }
            doc.Close();
        }
예제 #33
0
        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;

            if (MeetingId.HasValue)
            {
                meeting = DbUtil.Db.Meetings.Single(mt => mt.MeetingId == MeetingId);
                Debug.Assert(meeting.MeetingDate != null, "meeting.MeetingDate != null");
                NewMeetingInfo = new NewMeetingInfo {
                    MeetingDate = meeting.MeetingDate.Value
                };
            }

            var list1 = NewMeetingInfo.ByGroup ? ReportList2().ToList() : ReportList().ToList();

            if (!list1.Any())
            {
                Response.Write("no data found");
                return;
            }
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=foo.pdf");

            doc = new Document(PageSize.LETTER.Rotate(), 36, 36, 64, 64);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);

            w.PageEvent = pageEvents;
            doc.Open();
            dc = w.DirectContent;

            box           = new PdfPCell();
            box.Border    = Rectangle.NO_BORDER;
            box.CellEvent = new CellEvent();

            OrgInfo lasto = null;

            foreach (var o in list1)
            {
                lasto = o;
                var table = new PdfPTable(1);
                table.DefaultCell.Border  = Rectangle.NO_BORDER;
                table.DefaultCell.Padding = 0;
                table.WidthPercentage     = 100;

                if (meeting != null)
                {
                    var q = from at in meeting.Attends
                            where at.AttendanceFlag || AttendCommitmentCode.committed.Contains(at.Commitment ?? 0)
                            orderby at.Person.LastName, at.Person.FamilyId, at.Person.Name2
                        select new
                    {
                        at.MemberType.Code,
                        Name2 = NewMeetingInfo.UseAltNames && at.Person.AltName.HasValue() ? at.Person.AltName : at.Person.Name2,
                        at.PeopleId,
                        at.Person.DOB
                    };
                    if (q.Any())
                    {
                        StartPageSet(o);
                    }
                    foreach (var a in q)
                    {
                        table.AddCell(AddRow(a.Code, a.Name2, a.PeopleId, a.DOB, "", font));
                    }
                }
                else if (OrgSearchModel != null)
                {
                    var q = from om in DbUtil.Db.OrganizationMembers
                            where om.OrganizationId == o.OrgId
                            join m in DbUtil.Db.OrgPeople(o.OrgId, o.Groups) on om.PeopleId equals m.PeopleId
                            where om.EnrollmentDate <= Util.Now
                            orderby om.Person.LastName, om.Person.FamilyId, om.Person.Name2
                    let p = om.Person
                            let ch = NewMeetingInfo.UseAltNames && p.AltName != null && p.AltName.Length > 0
                                     select new
                    {
                        p.PeopleId,
                        Name2     = ch ? p.AltName : p.Name2,
                        BirthDate = Person.FormatBirthday(
                            p.BirthYr,
                            p.BirthMonth,
                            p.BirthDay, p.PeopleId),
                        MemberTypeCode = om.MemberType.Code,
                        ch,
                        highlight =
                            om.OrgMemMemTags.Any(mm => mm.MemberTag.Name == NewMeetingInfo.HighlightGroup)
                                        ? NewMeetingInfo.HighlightGroup
                                        : ""
                    };
                    if (q.Any())
                    {
                        StartPageSet(o);
                    }
                    foreach (var m in q)
                    {
                        table.AddCell(AddRow(m.MemberTypeCode, m.Name2, m.PeopleId, m.BirthDate, m.highlight, m.ch ? china ?? font : font));
                    }
                }
                else if (Filter?.GroupSelect == GroupSelectCode.Member)
                {
                    var q = from om in DbUtil.Db.OrganizationMembers
                            where om.OrganizationId == Filter.Id
                            join m in DbUtil.Db.OrgFilterPeople(QueryId, null)
                            on om.PeopleId equals m.PeopleId
                            where om.EnrollmentDate <= Util.Now
                            where NewMeetingInfo.ByGroup == false || m.Groups.Contains((char)10 + o.Groups + (char)10)
                            orderby om.Person.LastName, om.Person.FamilyId, om.Person.Name2
                    let p = om.Person
                            let ch = NewMeetingInfo.UseAltNames && p.AltName != null && p.AltName.Length > 0
                                     select new
                    {
                        p.PeopleId,
                        Name2     = ch ? p.AltName : p.Name2,
                        BirthDate = Person.FormatBirthday(
                            p.BirthYr,
                            p.BirthMonth,
                            p.BirthDay,
                            p.PeopleId),
                        MemberTypeCode = om.MemberType.Code,
                        ch,
                        highlight =
                            om.OrgMemMemTags.Any(mm => mm.MemberTag.Name == NewMeetingInfo.HighlightGroup)
                                        ? NewMeetingInfo.HighlightGroup
                                        : ""
                    };
                    if (q.Any())
                    {
                        StartPageSet(o);
                    }
                    foreach (var m in q)
                    {
                        table.AddCell(AddRow(m.MemberTypeCode, m.Name2, m.PeopleId, m.BirthDate, m.highlight, m.ch ? china ?? font : font));
                    }
                }
                else
                {
                    var q = from m in DbUtil.Db.OrgFilterPeople(QueryId, null)
                            orderby m.Name2
                            let p                                              = DbUtil.Db.People.Single(pp => pp.PeopleId == m.PeopleId)
                                                      let om                   = p.OrganizationMembers.SingleOrDefault(mm => mm.OrganizationId == Filter.Id)
                                                                        let ch = NewMeetingInfo.UseAltNames && p.AltName != null && p.AltName.Length > 0
                                                                                 select new
                    {
                        p.PeopleId,
                        Name2     = ch ? p.AltName : p.Name2,
                        BirthDate = Person.FormatBirthday(
                            p.BirthYr,
                            p.BirthMonth,
                            p.BirthDay,
                            p.PeopleId),
                        MemberTypeCode = om == null ? "Guest" : om.MemberType.Code,
                        ch,
                        highlight = om.OrgMemMemTags.Any(mm => mm.MemberTag.Name == NewMeetingInfo.HighlightGroup) ? NewMeetingInfo.HighlightGroup : ""
                    };
                    if (q.Any())
                    {
                        StartPageSet(o);
                    }
                    foreach (var m in q)
                    {
                        table.AddCell(AddRow(m.MemberTypeCode, m.Name2, m.PeopleId, m.BirthDate, m.highlight, m.ch ? china ?? font : font));
                    }
                }
                if ((OrgSearchModel != null && NewMeetingInfo.ByGroup == false) ||
                    (Filter != null &&
                     Filter.GroupSelect == GroupSelectCode.Member &&
                     meeting == null &&
                     !Filter.SgFilter.HasValue() &&
                     !Filter.NameFilter.HasValue() &&
                     !Filter.FilterIndividuals == true &&
                     !Filter.FilterTag == true &&
                     NewMeetingInfo.ByGroup == false))
                {
                    foreach (var m in RollsheetModel.FetchVisitors(o.OrgId, NewMeetingInfo.MeetingDate, true, NewMeetingInfo.UseAltNames))
                    {
                        if (table.Rows.Count == 0)
                        {
                            StartPageSet(o);
                        }
                        table.AddCell(AddRow(m.VisitorType, m.Name2, m.PeopleId, m.BirthDate, "", boldfont));
                    }
                }
                if (!pageSetStarted)
                {
                    continue;
                }

                var col      = 0;
                var gutter   = 20f;
                var colwidth = (doc.Right - doc.Left - gutter) / 2;
                var ct       = new ColumnText(w.DirectContent);
                ct.AddElement(table);

                var status = 0;

                while (ColumnText.HasMoreText(status))
                {
                    if (col == 0)
                    {
                        ct.SetSimpleColumn(doc.Left, doc.Bottom, doc.Left + colwidth, doc.Top);
                    }
                    else
                    {
                        ct.SetSimpleColumn(doc.Right - colwidth, doc.Bottom, doc.Right, doc.Top);
                    }
                    status = ct.Go();
                    ++col;
                    if (col > 1)
                    {
                        col = 0;
                        doc.NewPage();
                    }
                }
            }
            if (!hasRows)
            {
                if (!pageSetStarted)
                {
                    StartPageSet(lasto);
                }
                doc.Add(new Paragraph("no members as of this meeting date and time to show on rollsheet"));
            }
            doc.Close();
        }
예제 #34
0
        private static IEnumerable <IRanking> GetRankingForOrg(this IDataContext context, int orgId, string nace5, int?adminLevel, int?beforeCount, int?afterCount, out OrgInfo orgInfo, out IEnumerable <IRanking> tops)
        {
            var cmd = context.Database.Connection.CreateCommand();

            cmd.CommandText = "GetRankingForOrg";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.AddParameter("@OrgId", orgId)
            .AddParameter("@Nace5", nace5)
            .AddParameter("@NumBefore", beforeCount)
            .AddParameter("@NumAfter", afterCount)
            .AddParameter("@administrativeLevel", adminLevel);

            var rankList = new List <Ranking>();

            tops = new List <Ranking>();

            const int orgInfoResultId               = 1;
            const int orgCountsResultId             = 2;
            const int revenueResultId               = 3;
            const int revenueTopResultId            = 4;
            const int marketShareResultId           = 5;
            const int marketShareTopResultId        = 6;
            const int ebitdaResultId                = 7;
            const int ebitdaTopResultId             = 8;
            const int operatingMarginResultId       = 9;
            const int operatingMarginTopResultId    = 10;
            const int costPerEmployeeResultId       = 11;
            const int costPerEmployeeTopResultId    = 12;
            const int numOfEmployeesResultId        = 13;
            const int numOfEmployeesTopResultId     = 14;
            const int revenuePerEmployeeResultId    = 15;
            const int revenuePerEmployeeTopResultId = 16;

            orgInfo = null;

            try {
                context.Database.Connection.Open();

                var  reader    = cmd.ExecuteReader();
                bool hasResult = true;
                int  resultId  = 1;
                while (hasResult)
                {
                    if (resultId == orgInfoResultId)
                    {
                        var spOrgInfo = ((IObjectContextAdapter)context).ObjectContext.Translate <SpOrgInfo>(reader);
                        orgInfo = spOrgInfo.First().ToOrgInfo();
                    }
                    else if (resultId == orgCountsResultId)
                    {
                        var spOrgCounts = ((IObjectContextAdapter)context).ObjectContext.Translate <SpOrgCount>(reader);
                        if (orgInfo != null)
                        {
                            orgInfo.Counts = new OrgCounts();
                            foreach (var spOrgCount in spOrgCounts)
                            {
                                if (spOrgCount.Category == orgInfo.Municipality)
                                {
                                    orgInfo.Counts.PerMunicipality = spOrgCount.companyCount;
                                }
                                else if (spOrgCount.Category == orgInfo.Region)
                                {
                                    orgInfo.Counts.PerRegion = spOrgCount.companyCount;
                                }
                                else
                                {
                                    orgInfo.Counts.PerNation = spOrgCount.companyCount;
                                }
                            }
                        }
                    }
                    else if (resultId == revenueResultId ||
                             resultId == ebitdaResultId ||
                             resultId == operatingMarginResultId ||
                             resultId == costPerEmployeeResultId ||
                             resultId == revenuePerEmployeeResultId)
                    {
                        rankList.AddRange(((IObjectContextAdapter)context).ObjectContext.Translate <LongRanking>(reader));
                    }
                    else if (resultId == revenueTopResultId ||
                             resultId == ebitdaTopResultId ||
                             resultId == operatingMarginTopResultId ||
                             resultId == costPerEmployeeTopResultId ||
                             resultId == revenuePerEmployeeTopResultId)
                    {
                        ((List <Ranking>)tops).AddRange(((IObjectContextAdapter)context).ObjectContext.Translate <LongRanking>(reader));
                    }
                    if (resultId == marketShareResultId)
                    {
                        var ranks = ((IObjectContextAdapter)context).ObjectContext.Translate <DecimalRanking>(reader);
                        rankList.AddRange(ranks);
                    }
                    else if (resultId == marketShareTopResultId)
                    {
                        ((List <Ranking>)tops).AddRange(((IObjectContextAdapter)context).ObjectContext.Translate <DecimalRanking>(reader));
                    }
                    else if (resultId == numOfEmployeesResultId)
                    {
                        rankList.AddRange(((IObjectContextAdapter)context).ObjectContext.Translate <IntRanking>(reader));
                    }
                    else if (resultId == numOfEmployeesTopResultId)
                    {
                        ((List <Ranking>)tops).AddRange(((IObjectContextAdapter)context).ObjectContext.Translate <IntRanking>(reader));
                    }

                    hasResult = reader.NextResult();
                    resultId++;
                }
            } finally {
                context.Database.Connection.Close();
            }

            return(rankList.AsReadOnly());
        }
예제 #35
0
        private PdfPTable StartPageSet(OrgInfo o)
        {
            var t = new PdfPTable(HeaderWids);
            t.DefaultCell.SetLeading(2.0f, 1f);
            t.DefaultCell.Border = PdfPCell.NO_BORDER;
            t.WidthPercentage = 100;
            t.DefaultCell.Padding = 5;
            pageEvents.StartPageSet("Leader Report: {0} - {1} ({2})".Fmt(o.Division, o.Name, o.Teacher));

            t.AddCell(new Phrase("\nPeopleId", boldfont));
            t.AddCell(new Phrase("Name\nEmail", boldfont));
            t.AddCell(new Phrase("\nPhones", boldfont));
            t.AddCell(new Phrase("\nMember Type", boldfont));
            return t;
        }
예제 #36
0
 public string Create(OrgInfo Org)
 {
     return(_IRole.CreateRole(Org.Name));
 }
예제 #37
0
 public void ReName(OrgInfo Org)
 {
     _IRole.ReName(Org.Key, Org.Name);
 }
예제 #38
0
파일: RosterResult.cs 프로젝트: vs06/bvcms
        private void StartPageSet(OrgInfo o)
        {
            t = new PdfPTable(4);
            t.WidthPercentage = 100;
            t.SetWidths(new int[] { 15, 30, 15, 40 });
            t.DefaultCell.Border = PdfPCell.NO_BORDER;
            pageEvents.StartPageSet(
                                    "{0}: {1}, {2} ({3})".Fmt(o.Division, o.Name, o.Location, o.Teacher),
                                    "({1})".Fmt(DateTime.Now, o.OrgId));

            var boldfont = FontFactory.GetFont(FontFactory.HELVETICA_BOLD);
            t.AddCell(new Phrase("PeopleId", boldfont));
            t.AddCell(new Phrase("Name", boldfont));
            t.AddCell(new Phrase("Member Type", boldfont));
            t.AddCell(new Phrase("Medical", boldfont));
            pagesetstarted = true;
        }