Esempio n. 1
0
        public static int UpdateUserCategory(string tableName, int id, int pid, int uid, string name, string pinyin = null, string pinyinabbr = null, string ename = null)
        {
            if (pinyin == null)
            {
                pinyin = HZ.ToPinYin(name, true);
            }
            if (pinyinabbr == null)
            {
                pinyinabbr = PinYin.GetInitial(name);
            }
            if (ename == null)
            {
                ename = pinyin;
            }

            //check pid & uid
            if (pid != 0 && !DBH.GetBoolean(QA.DBCS_CMS, CommandType.Text, "SELECT COUNT(id) FROM " + tableName + " WHERE pid=@pid AND uid=@uid", new SqlParameter("@pid", pid), new SqlParameter("@uid", uid)))
            {
                return(-1);
            }

            return(EB <UserCategoryEntity> .Update(QA.DBCS_CMS, new UserCategoryEntity()
            {
                id = id,
                uid = uid,
                pid = pid,
                name = name,
                pinyin = pinyin,
                pinyinabbr = pinyinabbr,
                ename = ename
            }, tableName));
        }
Esempio n. 2
0
        public static int CreateUserCategory(string tableName, int pid, int uid, string name, string pinyin = null, string pinyinabbr = null, string ename = null)
        {
            if (pinyin == null)
            {
                pinyin = HZ.ToPinYin(name, true);
            }
            if (pinyinabbr == null)
            {
                pinyinabbr = PinYin.GetInitial(name);
            }
            if (ename == null)
            {
                ename = pinyin;
            }

            return(EB <UserCategoryEntity> .Create(QA.DBCS_CMS, new UserCategoryEntity()
            {
                uid = uid,
                pid = pid,
                name = name,
                pinyin = pinyin,
                pinyinabbr = pinyinabbr,
                ename = ename
            }, tableName));
        }
Esempio n. 3
0
 public static int UpdatePost(PostEntity postEntity)
 {
     return(EB <PostEntity> .Update(QA.DBCS_MAIN, postEntity));
 }
Esempio n. 4
0
 public static int UpdateThread(ThreadEntity threadEntity)
 {
     return(EB <ThreadEntity> .Update(QA.DBCS_MAIN, threadEntity));
 }
Esempio n. 5
0
 public static IList <UserCategoryEntity> GetUserCategories(int uid, string tableName)
 {
     return(EB <UserCategoryEntity> .List(QA.DBCS_CMS, CommandType.Text, "SELECT id,pid,uid,name,count FROM " + tableName + " WHERE uid=@uid ORDER BY displayorder ASC,id ASC", new SqlParameter("@uid", uid)));
 }
Esempio n. 6
0
 public static ContentEntity Get(string tableName, int id)
 {
     return(EB <ContentEntity> .Get("SELECT * FROM " + tableName + " WHERE id=@id", new SqlParameter("@id", id)));
 }
Esempio n. 7
0
 public static IList <ContentEntity> List(string tableName)
 {
     return(EB <ContentEntity> .List(QA.DBCS_CMS, CommandType.Text, "SELECT * FROM " + tableName + " ORDER BY created DESC"));
 }
Esempio n. 8
0
 public static int Create(string tableName, ContentEntity entity)
 {
     return(EB <ContentEntity> .Create(QA.DBCS_CMS, entity, tableName));
 }
Esempio n. 9
0
 public static IList <PostEntity> GetThreadPosts(int tid)
 {
     return(EB <PostEntity> .List(QA.DBCS_MAIN, CommandType.Text, "SELECT * FROM forum_post WHERE tid=@tid", new SqlParameter("@tid", tid)));
 }
Esempio n. 10
0
 public static IList <QuestionEntity> List(int count)
 {
     return(EB <QuestionEntity> .List(QA.DBCS_MAIN, CommandType.Text, "SELECT TOP " + count + " id,authorid,good,likes,created,author,title FROM question ORDER BY created DESC"));
 }
Esempio n. 11
0
 public static QuestionEntity Get(int id)
 {
     return(EB <QuestionEntity> .Get("SELECT * FROM question WHERE id=@id", new SqlParameter("@id", id)));
 }
Esempio n. 12
0
 public static int Update(QuestionEntity entity)
 {
     return(EB <QuestionEntity> .Update(QA.DBCS_MAIN, entity));
 }
Esempio n. 13
0
 public IList <QuotationEntity> RandomList(int count)
 {
     return(EB <QuotationEntity> .List(QA.DBCS_MAIN, CommandType.Text, "SELECT TOP " + count + " * FROM quotation ORDER BY newid()"));
 }
Esempio n. 14
0
 public static PostEntity GetPost(int pid)
 {
     return(EB <PostEntity> .Get("SELECT * FROM forum_post WHERE pid=@pid", new SqlParameter("@pid", pid)));
 }
Esempio n. 15
0
 internal static IList <CYEntity> List(int count)
 {
     return(EB <CYEntity> .List(DBQA.DBCS_DICT_CY, CommandType.Text, "SELECT TOP " + count + " id, name,pinyinabbr FROM chengyu ORDER BY newid();"));
 }
Esempio n. 16
0
 internal static IList <ThreadEntity> GetThreads()
 {
     return(EB <ThreadEntity> .List(QA.DBCS_MAIN, CommandType.Text, "SELECT * FROM forum_thread ORDER BY created DESC"));
 }
Esempio n. 17
0
        public EDI271SchemaModel ParseEDI271(string fileText)
        {
            string    claimSegment          = string.Empty;
            bool      payerLoopVisited      = false;
            bool      submitterLoopVisited  = false;
            bool      subscriberLoopVisited = false;
            bool      ebSegmentVisited      = false;
            bool      dtpSegmentVisited     = true;
            EB        EB           = null;
            List <EB> ebList       = null;
            string    segmentValue = string.Empty;

            string[] ediTextArray = fileText.Split("~");
            foreach (string stringSegment in ediTextArray)
            {
                string[] segmentArray = stringSegment.Split("*");
                if (segmentArray != null)
                {
                    IEnumerable <string> values = Enum.GetValues(typeof(EDI271Segments))
                                                  .OfType <EDI271Segments>()
                                                  .Select(s => Convert.ToString(s));

                    if (values.Contains(segmentArray[0].TrimStart()))
                    {
                        segmentValue = segmentArray[0].TrimStart();
                        switch (segmentValue)
                        {
                        case "ISA":
                        {
                            ISA ISA = GetSegmentInfo <ISA>(new ISA(), segmentArray);
                            ediSchemaModel.ISA = ISA;
                            break;
                        }

                        case "GS":
                        {
                            GS GS = GetSegmentInfo <GS>(new GS(), segmentArray);
                            ediSchemaModel.GS = GS;
                            break;
                        }

                        case "ST":
                        {
                            ST ST = GetSegmentInfo <ST>(new ST(), segmentArray);
                            ediSchemaModel.ST = ST;
                            break;
                        }

                        case "AAA":
                        {
                            AAA AAA = GetSegmentInfo <AAA>(new AAA(), segmentArray);
                            ediSchemaModel.AAA = AAA;
                            break;
                        }

                        case "NM1":
                        {
                            NM1 NM1 = GetSegmentInfo <NM1>(new NM1(), segmentArray);
                            if (NM1 != null && NM1.NM101 == "PR" && payerLoopVisited == false)
                            {
                                ediSchemaModel.PayerDetails = NM1;
                                payerLoopVisited            = true;
                            }
                            else if (NM1 != null && NM1.NM101 == "1P" && submitterLoopVisited == false)
                            {
                                ediSchemaModel.SubmitterDetails = NM1;
                                submitterLoopVisited            = true;
                            }
                            else if (NM1 != null && NM1.NM101 == "IL" && subscriberLoopVisited == false)
                            {
                                ediSchemaModel.SubscriberDetails = NM1;
                                subscriberLoopVisited            = true;
                            }
                            break;
                        }

                        case "EB":
                        {
                            if (EB != null)
                            {
                                if (EB.EB01 == "1" || EB.EB01 == "6" || EB.EB01 == "I")
                                {
                                    ebList = new List <EB>();
                                    ebList = EB.EB03.Split("^").Select(x => new EB()
                                        {
                                            EB01 = EB.EB01,
                                            EB02 = EB.EB02,
                                            EB03 = x,
                                            EB04 = EB.EB04,
                                            EB05 = EB.EB05,
                                            EB06 = EB.EB06,
                                            EB07 = EB.EB07,
                                            EB08 = EB.EB08,
                                            EB09 = EB.EB09,
                                            EB10 = EB.EB10,
                                            EB11 = EB.EB11,
                                            EB12 = EB.EB12,
                                            EB13 = EB.EB13,
                                            EB14 = EB.EB14
                                        }).ToList();
                                }

                                if (EB.EB01 == "1")
                                {
                                    ediSchemaModel.ActivePlans.AddRange(ebList);
                                }
                                else if (EB.EB01 == "6")
                                {
                                    ediSchemaModel.InactivePlans.AddRange(ebList);
                                }
                                else if (EB.EB01 == "I")
                                {
                                    ediSchemaModel.NonCoveredPlan.AddRange(ebList);
                                }
                                else if (EB.EB01 == "C" && (EB.EB06 == "" || EB.EB06 == "26"))
                                {
                                    ediSchemaModel.BaseDeductiblesAllPlans.Add(EB);
                                }
                                else if (EB.EB01 == "C" && EB.EB06 == "29")
                                {
                                    ediSchemaModel.RemainingDeductiblesAllPlans.Add(EB);
                                }
                                else if (EB.EB01 == "A")
                                {
                                    ediSchemaModel.CoinsuranceAllPlans.Add(EB);
                                }
                                else if (EB.EB01 == "B")
                                {
                                    ediSchemaModel.CopayAllPlans.Add(EB);
                                }
                            }
                            EB = GetSegmentInfo <EB>(new EB(), segmentArray);
                            ebSegmentVisited = true;
                            break;
                        }

                        case "DTP":
                        {
                            if (EB != null && ebSegmentVisited == true)
                            {
                                EB.DTP = GetSegmentInfo <DTP>(new DTP(), segmentArray);
                            }
                            //EB = null;
                            ebSegmentVisited = false;
                            break;
                        }
                        }
                    }
                }
            }
            return(ediSchemaModel);
        }
Esempio n. 18
0
 public static ContentEntity Get(int id, string tableName)
 {
     return(EB <ContentEntity> .Get(QA.DBCS_CMS, CommandType.Text, "SELECT * FROM " + tableName + " WHERE id=@id", new SqlParameter("@id", id)));
 }
Esempio n. 19
0
 //public IList<
 public static IList <BoardEntity> GetBoardList()
 {
     return(EB <BoardEntity> .List(QA.DBCS_MAIN, CommandType.Text, "SELECT * FROM forum_board WHERE status=0 AND type=2"));
 }
Esempio n. 20
0
 public static int Update(ContentEntity entity, string tableName)
 {
     return(EB <ContentEntity> .Update(QA.DBCS_CMS, entity, tableName));
 }
Esempio n. 21
0
 public static BoardEntity GetBoard(int bid)
 {
     return(EB <BoardEntity> .Get(QA.DBCS_MAIN, CommandType.Text, "SELECT * FROM forum_board WHERE bid=@bid", new SqlParameter("@bid", bid)));
 }
Esempio n. 22
0
 public static ContentEntity Get(string tableName, string key)
 {
     return(EB <ContentEntity> .Get("SELECT * FROM " + tableName + " WHERE url=@url", new SqlParameter("@url", key)));
 }
Esempio n. 23
0
 public static ThreadEntity GetThread(int tid)
 {
     return(EB <ThreadEntity> .Get("SELECT * FROM forum_thread WHERE tid=@tid", new SqlParameter("@tid", tid)));
 }
Esempio n. 24
0
        private void BuildStoreInventoryList(int year, int storeId, DataTable dtItm)
        {
            string[] str = { "Item Name", "Batch No.", "Remark", "Unit Price" };
            foreach (string co in str)
            {
                dtBB.Columns.Add(co);
            }
            str = new string[] { "ItemId", "No.", "Beginning Balance", "Ending Balance(SOH)", "Physical Inventory", "ID", "RecID" };//, "Change Since Sene 30" };

            foreach (string co in str)
            {
                dtBB.Columns.Add(co, typeof(int));
            }
            int count    = 1;
            var yProcess = new YearEnd();
            var bal      = new Balance();

            dtDate.Value = DateTime.Now;
            DateTime dtCurent = new DateTime();

            dtDate.CustomFormat = "MM/dd/yyyy";
            dtCurent            = ConvertDate.DateConverter(dtDate.Text);

            var recDoc = new ReceiveDoc();
            int month  = dtCurent.Month - 1;

            var yEnd = new YearEnd();


            foreach (DataRow dr in dtItm.Rows)//For each item
            {
                string itemName      = dr["ItemName"].ToString() + " - " + dr["DosageForm"].ToString() + " - " + dr["Strength"].ToString();
                int    itemID        = Convert.ToInt32(dr["ID"]);
                bool   BalanceExists = (yProcess.DoesBalanceExist(year, storeId, itemID, false));

                //We don't want to display those items whose inventory has already been done.
                if (BalanceExists)
                {
                    continue;
                }

                //bereket
                //Int64 soh = bal.GetSOH(Convert.ToInt32(dr["ID"]), storeId, 10, year);
                var soh  = bal.GetSOHOptimized(Convert.ToInt32(dr["ID"]), storeId, month, year);
                var bbal = yEnd.GetBBalance(year, storeId, Convert.ToInt32(dr["ID"]), month);

                yProcess.GetBalanceByItemId(year, storeId, Convert.ToInt32(dr["ID"]));

                Int64 BB;
                BB = yProcess.RowCount > 0 ? yProcess.BBalance : bbal;
                Int64 EB;
                EB = yProcess.RowCount > 0 && yProcess.EBalance != 0 ? yProcess.EBalance : soh;
                //Now if the physical inventory is chosen to be default value, we set it to the ending balance of last year.
                string Phy = (yProcess.RowCount > 0) ? yProcess.PhysicalInventory.ToString() : (_defaultValueToPhysicalInventory ? EB.ToString() : "");
                //int id = (yProcess.RowCount > 0) ? yProcess.ID : 0;
                string remark = (yProcess.RowCount > 0) ? yProcess.Remark : "";
                //object[] obj = { Convert.ToInt32(dr["ID"]), count, itemName, "", BB, ((EB != 0) ? EB.ToString("#,###") : "0"), Phy, remark, id, -1 };
                //dtBB.Rows.Add(obj);
                DataRowView drv = dtBB.DefaultView.AddNew();
                if (yProcess.RowCount > 0)
                {
                    drv["ID"] = yProcess.ID;
                }
                drv["ItemId"]              = dr["ID"];
                drv["No."]                 = count;
                drv["Item Name"]           = itemName;
                drv["Beginning Balance"]   = BB;
                drv["Ending Balance(SOH)"] = EB;

                if (Phy != "")
                {
                    drv["Physical Inventory"] = Phy;
                }
                drv["RecID"]      = -1;
                drv["Unit Price"] = "_";
                drv["Remark"]     = remark;
                //drv["Change Since Sene 30"] = BLL.Balance.GetChangeAfterDate(itemID, storeId, ethioDate.EndOfFiscalYear.ToGregorianDate());
                count++;
                //if (!BalanceExists)
                //{
                int       theLastBalance = 0;
                DataTable dtBatchs       = recDoc.GetBatchWithValue(storeId, Convert.ToInt32(dr["ID"]), dtCurent);
                foreach (DataRow drBatch in dtBatchs.Rows.Cast <DataRow>().Where(drBatch => drBatch["QuantityLeft"] != DBNull.Value && Convert.ToInt64(drBatch["QuantityLeft"]) != 0))
                {
                    drv = dtBB.DefaultView.AddNew();
                    drv["Item Name"]           = ">>";
                    drv["Batch No."]           = drBatch["BatchNo"];
                    drv["Ending Balance(SOH)"] = Convert.ToInt64(drBatch["QuantityLeft"]);
                    //Now if the physical inventory is chosen to be default value, we set it to the ending balance of last year.
                    if (_defaultValueToPhysicalInventory)
                    {
                        drv["Physical Inventory"] = drBatch["QuantityLeft"].ToString();
                    }
                    theLastBalance   += Convert.ToInt32(drBatch["QuantityLeft"]);
                    drv["RecID"]      = drBatch["ID"];
                    drv["Unit Price"] = drBatch["Cost"];
                }
                //}
            }

            grdYearEnd.DataSource = dtBB;
            dtDate.CustomFormat   = "MMMM dd, yyyy";
        }
Esempio n. 25
0
 public static IList <CategoryEntity> GetTopCategories(string tableName)
 {
     return(EB <CategoryEntity> .List(QA.DBCS_CMS, CommandType.Text, "SELECT id,pid,name,count FROM " + tableName + " WHERE pid=0 ORDER BY count DESC"));
 }