예제 #1
0
        public int AddDeleteChangeItem(int bhikkuChangeListID, int asapuwaID, int bhikkuID, DBCore.BhikkuPost post, DBCore.BhikkuChangeType changeType, bool isUpasampanna)
        {
            using (ChangeList change = new ChangeList(true))
            {
                saveHistrybtn.Enabled = true;

                if (ChangeListID == 0)
                {
                    change.FromDate = FromDate;
                    change.Todate   = ToDate;


                    ChangeListID = change.Add();
                }

                if (bhikkuChangeListID == 0)
                {
                    if (isUpasampanna)
                    {
                        upasampadaChangeCount++;
                    }
                    else
                    {
                        samaneraChangeCount++;
                    }

                    setSummaryCounts();

                    return(change.AddBhikkuAsapuwa(ChangeListID, asapuwaID, bhikkuID, post, changeType));
                }
                else
                {
                    // delete bhikku
                    if (asapuwaID == -1)
                    {
                        if (isUpasampanna)
                        {
                            upasampadaChangeCount--;
                        }
                        else
                        {
                            samaneraChangeCount--;
                        }

                        change.DeleteBhikkuAsapuwa(bhikkuChangeListID);
                        setSummaryCounts();
                        return(0);
                    }
                    else
                    {
                        change.UpdateBhikkuAsapuwa(bhikkuChangeListID, post, changeType);
                        return(bhikkuChangeListID);
                    }
                }
            }
        }