Example #1
0
        private void Simpan_Click(object sender, EventArgs e)
        {
            if (!validator.Validate())
            {
                return;
            }

            SalesModel sales = (SalesModel)SalesBS.Current;

            sales.salesheadId = sh_coll.First(sh => sh.id == Convert.ToInt64(salesheadid.EditValue));
            sales.createdAt   = DateTime.Now;
            sales.updatedAt   = DateTime.Now;
            sales.Save();
            SalesXpCollection.Add(sales);
            SalesUOW.CommitChanges();
            SalesBS.EndEdit();

            SetDisabled();

            Tambah.Enabled = true;
            Simpan.Enabled = false;
            Batal.Enabled  = false;
            Edit.Enabled   = true;
            Hapus.Enabled  = true;

            gridControl1.Enabled = true;
        }
        public string GetVerseTranslation(Session session, int numberOfBook, int numberOfChapter, int verseStart, int verseEnd = 0, string translationName = "NPI")
        {
            if (verseEnd == 0)
            {
                var index = $"{translationName}.{numberOfBook}.{numberOfChapter}.{verseStart}";
                var verse = new XPQuery <Verse>(session).Where(x => x.Index == index).FirstOrDefault();
                if (verse.IsNotNull())
                {
                    var verseText = verse.GetTranslationText();
                    if (verseText.IsNotNullOrWhiteSpace())
                    {
                        return(verseText);
                    }
                    else
                    {
                        return(GetOtherVerseTranslation(session, numberOfBook, numberOfChapter, verseStart));
                    }
                }
                else
                {
                    return(GetOtherVerseTranslation(session, numberOfBook, numberOfChapter, verseStart));
                }
            }
            else
            {
                var predicate = PredicateBuilder.New <Verse>();
                for (int i = verseStart; i < verseEnd + 1; i++)
                {
                    var index = $"{translationName}.{numberOfBook}.{numberOfChapter}.{i}";
                    predicate = predicate.Or(x => x.Index == index);
                }
                var verses = new XPQuery <Verse>(session).Where(predicate);

                if (verses.Count() > 0)
                {
                    if (verses.First().GetTranslationText().IsNotNullOrWhiteSpace())
                    {
                        var versesText = String.Empty;
                        foreach (var item in verses)
                        {
                            versesText += item.GetTranslationText() + " ";
                        }
                        return(versesText.Trim());
                    }
                    else
                    {
                        return(GetOtherVersesTranslation(session, numberOfBook, numberOfChapter, verseStart, verseEnd));
                    }
                }
                else
                {
                    return(GetOtherVersesTranslation(session, numberOfBook, numberOfChapter, verseStart, verseEnd));
                }
            }
        }
Example #3
0
        public void SetCaseInfo(string sCaseNo)
        {
            try
            {
                var sOurNo      = s_OurNo;
                var sClientNo   = string.Empty;
                var sClientName = string.Empty;
                var sAppNo      = string.Empty;
                var sAppName    = string.Empty;

                CommonFunction.GetCaseInfo(ref sOurNo, ref sClientNo, ref sClientName, ref sAppNo, ref sAppName);
                if (string.IsNullOrWhiteSpace(sOurNo))
                {
                    return;
                }

                s_OurNo      = sOurNo;
                s_ClientNo   = sClientNo;
                s_ClientName = sClientName;
                s_AppNo      = sAppNo;
                s_AppName    = sAppName;

                var sCaseNoShort = sOurNo.Substring(0, sOurNo.IndexOf("-"));

                var bIsWriteCase = DbHelperOra.Exists($"select 1 from CASEOTHERINFO where infotype = 'W_case' and caseno = '{_sOurNo}' and info = 'Y'");

                //b_IsWriteCase = bIsWriteCase;

                var sDeptName = DbHelperOra.GetSingle($"select info from CASEOTHERINFO where infotype = 'department' and caseno = '{_sOurNo}'");
                if (!string.IsNullOrWhiteSpace(sDeptName?.ToString()))
                {
                    s_DeptName = sDeptName + "部";
                }

                if (sCaseNoShort.Contains("PI"))
                {
                    PatentCaseType = EnumsAll.PatentCaseType.中国申请_PCT进国家_发明;
                }
                else if (sCaseNoShort.Contains("PU"))
                {
                    PatentCaseType = EnumsAll.PatentCaseType.中国申请_PCT进国家_实用新型;
                }
                else if (sCaseNoShort.Contains("SE"))
                {
                    PatentCaseType = EnumsAll.PatentCaseType.其他注册申请_保密审查;
                }
                else if (sCaseNoShort.Contains("DJ"))
                {
                    PatentCaseType = EnumsAll.PatentCaseType.其他注册申请_版权登记;
                }
                else if (sCaseNoShort.Contains("P"))
                {
                    PatentCaseType = EnumsAll.PatentCaseType.国外申请_国际申请;
                }
                else if (sCaseNoShort.Contains("NI") || sCaseNoShort.Contains("I"))
                {
                    PatentCaseType = !bIsWriteCase ? EnumsAll.PatentCaseType.中国申请_巴黎公约_发明 : EnumsAll.PatentCaseType.中国申请_撰写_发明;
                }
                else if (sCaseNoShort.Contains("NU") || sCaseNoShort.Contains("U"))
                {
                    PatentCaseType = !bIsWriteCase ? EnumsAll.PatentCaseType.中国申请_巴黎公约_实用新型 : EnumsAll.PatentCaseType.中国申请_撰写_实用新型;
                }
                else if (sCaseNoShort.Contains("ND") || sCaseNoShort.Contains("D"))
                {
                    PatentCaseType = !bIsWriteCase ? EnumsAll.PatentCaseType.中国申请_巴黎公约_外观设计 : EnumsAll.PatentCaseType.中国申请_撰写_外观设计;
                }

                if (!string.IsNullOrWhiteSpace(s_AppNo))
                {
                    var sCodeCountry = Session.FindObject <Corporation>(CriteriaOperator.Parse("Code = ?", s_AppNo))?.Country?.s_Code;
                    if (!string.IsNullOrWhiteSpace(sCodeCountry))
                    {
                        if (PatentCaseType.ToString().Contains("中国") && sCodeCountry == "CN")
                        {
                            PatentDirection = EnumsAll.PatentDirection.内到内;
                        }
                        else if (PatentCaseType.ToString().Contains("国外") && sCodeCountry == "CN")
                        {
                            PatentDirection = EnumsAll.PatentDirection.内到外;
                        }
                        else if (PatentCaseType.ToString().Contains("中国") && sCodeCountry != "CN")
                        {
                            PatentDirection = EnumsAll.PatentDirection.外到内;
                        }
                        else if (PatentCaseType.ToString().Contains("国外") && sCodeCountry != "CN")
                        {
                            PatentDirection = EnumsAll.PatentDirection.外到外;
                        }
                        else
                        {
                            if (sCodeCountry == "CN")
                            {
                                PatentDirection = EnumsAll.PatentDirection.内到内;
                            }
                            else
                            {
                                PatentDirection = EnumsAll.PatentDirection.外到内;
                            }
                            PatentDirection = EnumsAll.PatentDirection.外到内;
                        }
                    }
                }


                b_IsDivCase = Regex.IsMatch(sCaseNoShort, @"\d{4}(D|d)");

                if (InternalInvoice == null)
                {
                    var tempInvoice = Session.FindObject <InternalInvoice>(CriteriaOperator.Parse("OurNo = ? And PatentSubmitLists.Count = 0", _sOurNo));
                    if (tempInvoice != null)
                    {
                        InternalInvoice = tempInvoice;
                        if (tempInvoice.PermissionPolicyUser != null)
                        {
                            Handler = tempInvoice.PermissionPolicyUser;
                        }
                    }
                }

                if (PatentPayments.Count == 0)
                {
                    var listPatentPayments = new XPQuery <PatentPayment>(Session).Where(p => p.PatentSubmitList == null && p.s_OurNo == _sOurNo).ToList();
                    if (listPatentPayments.Count > 0)
                    {
                        PatentPayments.AddRange(listPatentPayments);
                        if (listPatentPayments.Any(p => p.Creator != null))
                        {
                            Handler = listPatentPayments.First(p => p.Creator != null).Creator;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }