示例#1
0
        public override List <T> SuperRetrieveByName <T>(BaseEntity entity)
        {
            var            ObjPrepaid = (Prepaid)entity;
            var            lst        = new List <T>();
            List <Prepaid> MyList     = new List <Prepaid>();
            var            Query      = Context.SP_CRUD_PREPAID((int)CrudActionEnum.SuperRetrieveByName, ObjPrepaid.CreateBy, ObjPrepaid.Id_Prepaid, ObjPrepaid.Id_Customer,
                                                                ObjPrepaid.Id_Product, ObjPrepaid.Prepaid_Quantity, ObjPrepaid.Prepaid_Total, ObjPrepaid.Prepaid_Cash, ObjPrepaid.Prepaid_Change,
                                                                ObjPrepaid.Prepaid_Balance, ObjPrepaid.Name_Customer).ToList();

            foreach (SP_CRUD_PREPAIDResult Element in Query)
            {
                Prepaid Obj = new Prepaid(Element.ID_PREPAID, Element.CUSTOMER_NAME, Element.DESCRIP_PRICE, Element.PREPAID_QUANTITY,
                                          Element.PREPAID_TOTAL, Element.PREPAID_CASH, Element.PREPAID_CHANGE, Element.PREPAID_BALANCE, Element.PREPAID_STATE,
                                          Element.PREPAID_CREATEBY, Element.PREPAID_UPDATEDBY, Element.PREPAID_CREATEDATE, Element.PREPAID_UPDATEDATE);
                MyList.Add(Obj);
            }
            if (MyList.Count > 0)
            {
                foreach (var obj in MyList)
                {
                    lst.Add((T)Convert.ChangeType(obj, typeof(T)));
                }
            }
            return(lst);
        }
示例#2
0
        //
        // GET: /Prepaid/
        //Godzilla
        public async Task <ActionResult> Index()
        {
            var param = "ReloadFund"; var Param2 = "ReloadAllocDetail";
            var Model = new Prepaid
            {
                Status = await BaseClass.WebGetRefLib(param.Trim())
            };
            var viewModel = new PrepaidViewModel
            {
                _DeliveryAdvice = new DeliveryAdvice
                {
                    Status = await BaseClass.WebGetRefLib("ReloadAlloc")
                },
                _Prepaid       = Model,
                _PurchaseOrder = new PurchaseOrder
                {
                    Status = await BaseClass.WebGetRefLib(param.Trim())
                },
                _PrepaidCardnAcct = new PrepaidCardnAcct
                {
                    Status = await BaseClass.WebGetRefLib(Param2.Trim())
                }
            };

            return(View(viewModel));
        }
示例#3
0
        private void btnSelectFee_Click(object sender, EventArgs e)
        {
            Fee     fee     = new Fee();
            Balance balance = new Balance();

            //显示余额
            balance.PatientID = int.Parse(txPatientID2.Text);
            Prepaid prepaid = new Prepaid();

            if (prepaid.FindBalance(balance))
            {
                txBalance1.Text = balance.BalanceMoney.ToString();
            }
            else
            {
                MessageBox.Show("查无此病例");
            }
            //PrintFeeByDate
            fee.PatientID = int.Parse(txPatientID2.Text);
            fee.Time      = dateTimePicker2.Value.ToString("yyyy-MM-dd");
            if (prepaid.ShowFeeByDate(fee))
            {
                dataGridView1.DataSource = fee.FeeTable;
            }
            else
            {
                MessageBox.Show("本日没有交费项目");
            }
        }
示例#4
0
        public List <PurchaseOrder> WebReloadFundSearch(Prepaid Params)
        {
            var objDataEngine = new FleetDataEngine(AccessMode.CustomerService, DBType.Maint);

            objDataEngine.InitiateConnection();
            SqlParameter[] Parameters = new SqlParameter[5];
            Parameters[0] = String.IsNullOrEmpty(Params.AcctNo) ? new SqlParameter("@AcctNo", DBNull.Value) : new SqlParameter("@AcctNo", Params.AcctNo);
            Parameters[1] = String.IsNullOrEmpty(Params.SelectedStatus) ? new SqlParameter("@Sts", DBNull.Value) : new SqlParameter("@Sts", Params.SelectedStatus);
            Parameters[2] = String.IsNullOrEmpty(Params.DocNo) ? new SqlParameter("@DocNo", DBNull.Value) : new SqlParameter("@DocNo", Params.DocNo);



            Parameters[3] = new SqlParameter("@FromDate", ConvertDatetimeDB(Params.FromDate));
            Parameters[4] = new SqlParameter("@ToDate", ConvertDatetimeDB(Params.ToDate));
            var execResult   = objDataEngine.ExecuteCommand("WebReloadFundSearch", CommandType.StoredProcedure, Parameters);
            var _PrepaidList = new List <PurchaseOrder>();

            while (execResult.Read())
            {
                var _Po = new PurchaseOrder();
                _Po.TxnId          = ConvertToInt(execResult["TxnId"]);
                _Po.DocNo          = Convert.ToString(execResult["DocNo"]);
                _Po.TxnDate        = DateConverter(execResult["TxnDate"]);
                _Po.TxnAmt         = ConverterDecimal(execResult["POAmt"]);
                _Po.Balance        = ConverterDecimal(execResult["POBal"]);
                _Po.SelectedStatus = Convert.ToString(execResult["Sts"]);
                _Po.CreationDate   = DateConverter(execResult["CreationDate"]);
                _Po.XRefDoc        = Convert.ToString(execResult["Remarks"]);
                _Po.UserId         = Convert.ToString(execResult["CreatedBy"]);
                _PrepaidList.Add(_Po);
            }
            ;
            objDataEngine.CloseConnection();
            return(_PrepaidList);
        }
示例#5
0
        private void btnSelectOne2_Click(object sender, EventArgs e)
        {
            PrepaidPayment prepaidpayment = new PrepaidPayment();
            Prepaid        prepaid        = new Prepaid();

            prepaidpayment.PatientID = int.Parse(txPatientID4.Text);
            dataGridView3.DataSource = prepaid.FindPrepaidPaymentByPID(prepaidpayment);
        }
示例#6
0
        public Prepaid getPrepaid(Booking b)
        {
            DataTable dt  = pDB.getByID(b.BookingID.ToString(), b.BookingTypeID);
            Prepaid   ans = new Prepaid();

            foreach (DataRow dr in dt.Rows)
            {
                ans = dataTableToPrepaid(dr);
            }
            return(ans);
        }
示例#7
0
 public void Activate(Prepaid Obj)
 {
     try
     {
         _factory.Activate(Obj);
     }
     catch (Exception ex)
     {
         log.Error(ex.Message, ex);
     }
 }
示例#8
0
        public JsonResult ftWebReloadFundAltSearch(Prepaid model, jQueryDataTableParamModel Params)
        {
            var list = _Ops.WebReloadFundSearch(model);

            return(Json(new
            {
                sEcho = Params.sEcho,
                iTotalRecords = list.Count(),
                iTotalDisplayRecords = list.Count(),
                aaData = list.Select(x => new object[] { x.TxnId, x.DocNo, x.TxnDate, x.TxnAmt, x.Balance, x.SelectedStatus, x.UserId, x.CreationDate, x.XRefDoc })
            }, JsonRequestBehavior.AllowGet));
        }
示例#9
0
        public override int GetHashCode()
        {
            var hashCode = 1754935533;

            hashCode = hashCode * -1521134295 + Date.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Customer);

            hashCode = hashCode * -1521134295 + Status.GetHashCode();
            hashCode = hashCode * -1521134295 + Prepaid.GetHashCode();
            hashCode = hashCode * -1521134295 + Summ.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Description);

            return(hashCode);
        }
示例#10
0
        private void btnSelectP2_Click(object sender, EventArgs e)
        {
            Prepaid prepaid = new Prepaid();
            Fee     fee     = new Fee();

            fee.PatientID = int.Parse(txPatientID2.Text);
            if (prepaid.ShowFee(fee))
            {
                dataGridView3.DataSource = fee.FeeTable;
            }
            else
            {
                MessageBox.Show("本日没有交费项目");
            }
        }
示例#11
0
        private void btnPrepay_Click(object sender, EventArgs e)
        {
            PrepaidPayment prepaidpayment = new PrepaidPayment();

            prepaidpayment.PatientID = int.Parse(txPatientID1.Text);
            prepaidpayment.Prepay    = int.Parse(txPrepay.Text);
            prepaidpayment.Time      = dateTimePicker1.Value.ToString("yyyy-MM-dd");
            Prepaid prepaid = new Prepaid();

            if (prepaid.Pay(prepaidpayment))
            {
                MessageBox.Show("缴费'" + prepaidpayment.Prepay + "'元成功");
            }
            else
            {
                MessageBox.Show("缴费失败");
            }
        }
示例#12
0
        public void PayingSheet(Booking b)
        {
            Room     r  = rBUS.getRoomByID(b.RoomID);
            RoomType rt = rBUS.getRoomTypeByID(r.RoomType);
            Guest    g  = gBUS.getGuestByID(b.GuestID);
            Consume  c  = cBUS.getConsumeByID(b.BookingID.ToString(), b.BookingTypeID);
            Prepaid  p  = getPrepaid(b);

            Excel.Application xlApp       = new Excel.Application();
            Excel.Workbook    xlWorkbook  = xlApp.Workbooks.Open(@"C:\Users\Zunnie\Desktop\MyLastGift\BUS\thanhtoan.xlsx");
            Excel._Worksheet  xlWorksheet = xlWorkbook.Sheets[1];
            Excel.Range       xlRange     = xlWorksheet.UsedRange;

            xlRange.Cells[5, 3].Value2 = g.FullName;
            xlRange.Cells[5, 6].Value2 = g.DOB.ToString("MM/dd/yyyy");
            xlRange.Cells[6, 4].Value2 = g.InfoID;
            xlRange.Cells[6, 6].Value2 = g.Nationality;
            xlRange.Cells[7, 3].Value2 = "'" + b.RoomID;
            xlRange.Cells[7, 6].Value2 = rt.Price.ToString();
            xlRange.Cells[8, 4].Value2 = b.CheckIn.ToString("MM/dd/yyyy");
            xlRange.Cells[8, 7].Value2 = b.CheckIn.ToString("hh:mm");
            xlRange.Cells[9, 4].Value2 = b.CheckOut.ToString("MM/dd/yyyy");
            xlRange.Cells[9, 7].Value2 = b.CheckOut.ToString("hh:mm");
            TimeSpan span = b.CheckOut - b.CheckIn;
            double   days = Math.Ceiling((double)span.TotalHours / 24);

            xlRange.Cells[11, 5].Value2 = days.ToString();
            xlRange.Cells[11, 6].Value2 = rt.Price.ToString();
            xlRange.Cells[12, 5].Value2 = c.Surchare.ToString();
            xlRange.Cells[13, 5].Value2 = c.CoCaCola.ToString();
            xlRange.Cells[14, 5].Value2 = c.Lavie.ToString();
            xlRange.Cells[15, 5].Value2 = c.Snack.ToString();
            xlRange.Cells[16, 5].Value2 = c.InstantNoodle.ToString();
            xlRange.Cells[17, 5].Value2 = c.ExtraBed.ToString();
            xlRange.Cells[19, 7].Value2 = p.Amount.ToString();
            string sNewFileName = Path.Combine(Path.GetDirectoryName(@"C:\Users\ZunNie\Desktop\"),
                                               string.Concat(r.RoomID, "_", DateTime.Today.ToString("ddmmyyyy"), ".xlsx"));

            xlWorkbook.SaveAs(sNewFileName);
            xlApp.Quit();
        }
示例#13
0
        /// <summary>
        /// 查询一个人的余额和预交金记录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSelectOne1_Click(object sender, EventArgs e)
        {
            Balance        balance        = new Balance();
            PrepaidPayment prepaidpayment = new PrepaidPayment();

            //显示余额
            balance.PatientID = int.Parse(txPatientID3.Text);
            Prepaid prepaid = new Prepaid();

            if (prepaid.FindBalance(balance))
            {
                txBalance2.Text = balance.BalanceMoney.ToString();
            }
            else
            {
                MessageBox.Show("查无此病例");
            }
            //find PrepaidPayment by PatinetID
            prepaidpayment.PatientID = int.Parse(txPatientID3.Text);
            dataGridView2.DataSource = prepaid.FindPrepaidPaymentByPID(prepaidpayment);
        }
示例#14
0
        public List <T> RetrieveAllByIdUser <T>(Prepaid Obj)
        {
            var lst = new List <T>();

            try
            {
                var list = _factory.RetrieveByIdUser <Prepaid>(Obj);
                if (list.Count > 0)
                {
                    foreach (var obj in list)
                    {
                        lst.Add((T)Convert.ChangeType(obj, typeof(T)));
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);
            }
            return(lst);
        }
示例#15
0
        public List <T> SuperRetrieveByNameDescrip <T>(Prepaid Obj)
        {
            var lst = new List <T>();

            try
            {
                var list = _factory.SuperRetrieveByName <Accountreceivable>(Obj);
                if (list.Count > 0)
                {
                    foreach (var obj in list)
                    {
                        lst.Add((T)Convert.ChangeType(obj, typeof(T)));
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);
            }
            return(lst);
        }
示例#16
0
        public int getTotalPrice(Booking b)
        {
            Room     r  = rBUS.getRoomByID(b.RoomID);
            RoomType rt = rBUS.getRoomTypeByID(r.RoomType);
            Consume  c  = cBUS.getConsumeByID(b.BookingID.ToString(), b.BookingTypeID);
            Prepaid  p  = getPrepaid(b);

            Excel.Application xlApp       = new Excel.Application();
            Excel.Workbook    xlWorkbook  = xlApp.Workbooks.Open(@"C:\Users\Zunnie\Desktop\MyLastGift\BUS\thanhtoan.xlsx");
            Excel._Worksheet  xlWorksheet = xlWorkbook.Sheets[1];
            Excel.Range       xlRange     = xlWorksheet.UsedRange;

            TimeSpan span = b.CheckOut - b.CheckIn;
            double   days = Math.Ceiling((double)span.TotalHours / 24);

            int colaPrice     = (int)xlRange.Cells[13, 6].Value2;
            int surcharePrice = rt.Price / 2;
            int laviePrice    = (int)xlRange.Cells[14, 6].Value2;
            int snackPrice    = (int)xlRange.Cells[15, 6].Value2;
            int noodlePrice   = (int)xlRange.Cells[16, 6].Value2;
            int ExtraBed      = (int)xlRange.Cells[17, 6].Value2;

            xlApp.Quit();


            int total = (int)days * rt.Price;

            if (c != null)
            {
                total = total + colaPrice * c.CoCaCola + snackPrice * c.Snack + noodlePrice * c.InstantNoodle + c.Surchare * surcharePrice + c.ExtraBed * ExtraBed;
            }
            if (p != null)
            {
                total = total - p.Amount;
            }
            return(total);
        }
示例#17
0
        public ActionResult AddToCart(FormCollection collection)
        {
            ActionResult action;
            decimal      num;
            DateTime?    nullable;
            string       str;
            string       str1;
            string       str2;
            string       str3;

            try
            {
                if (base.ModelState.IsValid && collection["cart_details"] != null)
                {
                    List <Cart_Details> cartDetails = JsonConvert.DeserializeObject <List <Cart_Details> >(Convert.ToString(collection["cart_details"]));
                    if (cartDetails != null)
                    {
                        List <Cart_Details> list = (
                            from f in cartDetails
                            where f.lineType != "TD"
                            //Yoonus
                            group f by new { lineStatus = f.lineStatus, lineType = f.lineType, itemCode = f.itemCode, itemName = f.itemName, referenceTreatmentCode = f.referenceTreatmentCode, isFOC = f.isFOC, referenceTransactionNumber = f.referenceTransactionNumber, topupBalance = f.topupBalance, topupOutstanding = f.topupOutstanding } into f
                            //group f by new { lineStatus = f.lineStatus, lineType = f.lineType, itemCode = f.itemCode, itemName = f.itemName, referenceTreatmentCode = f.referenceTreatmentCode, isFOC = f.isFOC } into f
                            select new Cart_Details()
                        {
                            lineStatus = f.Key.lineStatus,
                            lineType = f.Key.lineType,
                            itemCode = f.Key.itemCode,
                            itemName = f.Key.itemName,
                            itemQty = f.Sum <Cart_Details>((Cart_Details s) => s.itemQty),
                            unitDiscount = f.Sum <Cart_Details>((Cart_Details s) => s.unitDiscount),
                            unitPrice = f.Sum <Cart_Details>((Cart_Details u) => u.unitPrice),
                            promoPrice = (f.Key.isFOC ? decimal.Zero : f.Sum <Cart_Details>((Cart_Details s) => s.itemQty * s.unitPrice) - f.Sum <Cart_Details>((Cart_Details s) => s.unitDiscount)),
                            itemAmount = (f.Key.isFOC ? decimal.Zero : f.Sum <Cart_Details>((Cart_Details s) => s.itemQty * s.unitPrice) - f.Sum <Cart_Details>((Cart_Details s) => s.unitDiscount)),
                            salesAmount = (f.Key.isFOC ? decimal.Zero : f.Sum <Cart_Details>((Cart_Details s) => s.itemQty * s.unitPrice) - f.Sum <Cart_Details>((Cart_Details s) => s.unitDiscount)),
                            referenceTreatmentCode = f.Key.referenceTreatmentCode,
                            //Yoonus
                            referenceTransactionNumber = f.Key.referenceTransactionNumber,
                            topupBalance = f.Key.topupBalance,
                            topupOutstanding = f.Key.topupOutstanding,
                            //Yoonus
                            isFOC = f.Key.isFOC,
                            courseDetails = new List <Course_Details>(),
                            discountDetails = new List <Discounts>(),
                            salesStaffDetails = new List <SalesStaff>(),
                            prepaidAccountDetails = new List <Prepaid>()
                        }).ToList <Cart_Details>();
                        List <Settings> item = ((app.bsms.Models.Account.User)base.Session["Login_Details"]).settings;
                        bool            flag = ((
                                                    from s in item
                                                    where s.settingName == "GST SETTING"
                                                    select s).FirstOrDefault <Settings>().settingValue == "INCLUSIVE" ? true : false);
                        decimal one = Convert.ToDecimal((
                                                            from s in item
                                                            where s.settingName == "GST PERCENTAGE"
                                                            select s).FirstOrDefault <Settings>().settingValue);
                        one = decimal.One + (one / new decimal(100));
                        string str4 = (
                            from s in item
                            where s.settingName == "GST APPLY BY"
                            select s).FirstOrDefault <Settings>().settingValue;
                        foreach (Cart_Details zero in list)
                        {
                            app.bsms.api.Service.Parameters.Clear();
                            app.bsms.api.Service.Parameters.Add("siteCode", ((app.bsms.Models.Account.User)base.Session["Login_Details"]).siteCode);
                            app.bsms.api.Service.Parameters.Add("itemCode", zero.itemCode);
                            //Item item1 = app.bsms.api.Service.Get<Item>("getItemDetails");
                            //Yoonus Changing to getItemDetail
                            Item         item1         = app.bsms.api.Service.Get <Item>("getItemDetail");
                            Cart_Details courseDetails = (
                                from f in cartDetails
                                where f.itemCode == zero.itemCode
                                select f).FirstOrDefault <Cart_Details>();
                            zero.salesStaffDetails = courseDetails.salesStaffDetails;
                            if (courseDetails.salesStaffDetails == null)
                            {
                                zero.strStaffs = null;
                            }
                            else
                            {
                                zero.strStaffs = JsonConvert.SerializeObject(courseDetails.salesStaffDetails);
                                Cart_Details cartDetail = zero;
                                if (courseDetails.strStaffs == "[]")
                                {
                                    str3 = null;
                                }
                                else
                                {
                                    str3 = courseDetails.strStaffs;
                                }
                                cartDetail.strStaffs = str3;
                            }
                            if (zero.lineType == "TD")
                            {
                                zero.discountDetails = null;
                                zero.strDiscounts    = null;
                            }
                            else
                            {
                                zero.discountDetails = courseDetails.discountDetails;
                                if (courseDetails.discountDetails == null)
                                {
                                    zero.strDiscounts = null;
                                }
                                else
                                {
                                    zero.strDiscounts = JsonConvert.SerializeObject(courseDetails.discountDetails);
                                    Cart_Details cartDetail1 = zero;
                                    if (courseDetails.strDiscounts == "[]")
                                    {
                                        str2 = null;
                                    }
                                    else
                                    {
                                        str2 = courseDetails.strDiscounts;
                                    }
                                    cartDetail1.strDiscounts = str2;
                                    zero.unitDiscount        = zero.discountDetails.Sum <Discounts>((Discounts d) => d.discountAmount);
                                    zero.discountPercent     = zero.discountDetails.Sum <Discounts>((Discounts p) => p.discountPercentage);
                                    zero.discountUser        = courseDetails.discountUser;
                                }
                            }
                            if (zero.lineType == "COURSE")
                            {
                                if (courseDetails.courseDetails == null)
                                {
                                    zero.promoPrice = (zero.unitPrice * zero.itemQty) - zero.unitDiscount;
                                }
                                else if (courseDetails.courseDetails.FirstOrDefault <Course_Details>().courseType != "N")
                                {
                                    zero.promoPrice = (zero.unitPrice * zero.itemQty) - zero.unitDiscount;
                                }
                                else
                                {
                                    zero.totalTreatments = courseDetails.totalTreatments;
                                    Cart_Details value     = zero;
                                    int?         nullable1 = zero.totalTreatments;
                                    value.promoPrice = (nullable1.Value * zero.unitPrice) - zero.unitDiscount;
                                }
                                zero.itemAmount    = zero.promoPrice;
                                zero.salesAmount   = zero.promoPrice;
                                zero.depositAmount = (zero.depositAmount.IsNullOrZero() ? new decimal?(zero.promoPrice) : zero.depositAmount);
                            }
                            else if (!(zero.lineType == "VOUCHER") || !(item1.brandName == "NON SALES VOUCHER"))
                            {
                                zero.promoPrice = (zero.isFOC ? decimal.Zero : (zero.unitPrice * zero.itemQty) - zero.unitDiscount);
                                zero.itemAmount = (zero.isFOC ? decimal.Zero : zero.promoPrice);
                                if (zero.lineType != "TD")
                                {
                                    zero.balanceAmount = decimal.Zero;
                                    zero.salesAmount   = (zero.isFOC ? decimal.Zero : zero.promoPrice);
                                    zero.depositAmount = (zero.depositAmount.IsNullOrZero() ? new decimal?(zero.promoPrice) : zero.depositAmount);
                                }
                                else
                                {
                                    zero.balanceAmount        = courseDetails.balanceAmount;
                                    zero.treatmentCode        = courseDetails.treatmentCode;
                                    zero.isFirstTreatmentDone = courseDetails.isFirstTreatmentDone;
                                    zero.salesAmount          = decimal.Zero;
                                    Cart_Details nullable2 = zero;
                                    num = new decimal();
                                    nullable2.depositAmount = new decimal?(num);
                                }
                            }
                            else
                            {
                                zero.promoPrice  = decimal.Zero;
                                zero.itemAmount  = decimal.Zero;
                                zero.salesAmount = decimal.Zero;
                                Cart_Details cartDetail2 = zero;
                                num = new decimal();
                                cartDetail2.depositAmount = new decimal?(num);
                            }
                            if (zero.lineType != "COURSE")
                            {
                                if (courseDetails.courseDetails == null)
                                {
                                    courseDetails.courseDetails = new List <Course_Details>();
                                }
                                if (zero.lineType != "PACKAGE")
                                {
                                    Course_Details courseDetail = new Course_Details()
                                    {
                                        treatmentNumber    = 1,
                                        itemCode           = zero.itemCode,
                                        itemDescription    = zero.itemName,
                                        treatmentUnitPrice = zero.itemAmount,
                                        courseType         = "N",
                                        treatmentStatus    = (courseDetails.isFirstTreatmentDone ? "Done" : "Open"),
                                        treatmentDate      = DateTime.Now
                                    };
                                    nullable = null;
                                    courseDetail.nextAppt = nullable;
                                    courseDetail.isFOC    = new bool?(zero.isFOC);
                                    courseDetails.courseDetails.Add(courseDetail);
                                }
                                else
                                {
                                    courseDetails.courseDetails = new List <Course_Details>();
                                    app.bsms.api.Service.Parameters.Clear();
                                    app.bsms.api.Service.Parameters.Add("siteCode", ((app.bsms.Models.Account.User)base.Session["Login_Details"]).siteCode);
                                    app.bsms.api.Service.Parameters.Add("itemCode", zero.itemCode);
                                    List <PackageDetails> packageDetails = new List <PackageDetails>();
                                    packageDetails.AddRange(app.bsms.api.Service.GetList <PackageDetails>("packageContent"));
                                    foreach (PackageDetails packageDetail in packageDetails)
                                    {
                                        for (int i = 0; i < packageDetail.quantity; i++)
                                        {
                                            Course_Details courseDetail1 = new Course_Details()
                                            {
                                                treatmentNumber    = packageDetail.lineNumber,
                                                itemCode           = packageDetail.contentItemCode,
                                                itemDescription    = packageDetail.contentItemName,
                                                treatmentUnitPrice = packageDetail.price,
                                                courseType         = "N",
                                                treatmentStatus    = (courseDetails.isFirstTreatmentDone ? "Done" : "Open"),
                                                treatmentDate      = DateTime.Now
                                            };
                                            nullable = null;
                                            courseDetail1.nextAppt = nullable;
                                            courseDetail1.isFOC    = new bool?(zero.isFOC);
                                            courseDetails.courseDetails.Add(courseDetail1);
                                        }
                                    }
                                }
                            }
                            zero.courseDetails = courseDetails.courseDetails;
                            if (zero.lineType == "PREPAID")
                            {
                                if (courseDetails.prepaidAccountDetails != null)
                                {
                                    zero.strPrepaid = JsonConvert.SerializeObject(courseDetails.prepaidAccountDetails);
                                    Cart_Details cartDetail3 = zero;
                                    if (zero.strStaffs == "[]")
                                    {
                                        str1 = null;
                                    }
                                    else
                                    {
                                        str1 = zero.strStaffs;
                                    }
                                    cartDetail3.strPrepaid = str1;
                                }
                                else if (!item1.openPrepaid)
                                {
                                    courseDetails.prepaidAccountDetails = new List <Prepaid>();
                                    app.bsms.api.Service.Parameters.Clear();
                                    app.bsms.api.Service.Parameters.Add("siteCode", ((app.bsms.Models.Account.User)base.Session["Login_Details"]).siteCode);
                                    app.bsms.api.Service.Parameters.Add("rangeCode", item1.rangeCode);
                                    ItemType itemType = app.bsms.api.Service.GetList <ItemType>("prepaid").FirstOrDefault <ItemType>((ItemType f) => f.stockCode == zero.itemCode);
                                    if (itemType != null)
                                    {
                                        foreach (Prepaid prepaid in itemType.prepaidCondition)
                                        {
                                            List <Prepaid> prepaids = courseDetails.prepaidAccountDetails;
                                            Prepaid        prepaid1 = new Prepaid()
                                            {
                                                prepaidLineNumber = 1,
                                                prepaidType       = zero.itemCode
                                            };
                                            decimal?nullable3 = prepaid.prepaidValue;
                                            prepaid1.prepaidBonus = nullable3.Value - zero.unitPrice;
                                            decimal num1 = zero.unitPrice;
                                            nullable3                  = prepaid.prepaidValue;
                                            prepaid1.prepaidTotal      = num1 + (nullable3.Value - zero.unitPrice);
                                            prepaid1.prepaidAmount     = new decimal?(zero.unitPrice);
                                            prepaid1.prepaidValue      = prepaid.prepaidValue;
                                            prepaid1.prepaidItemType   = prepaid.prepaidItemType;
                                            prepaid1.prepaidCondition1 = (prepaid.prepaidCondition1 == null ? "All" : prepaid.prepaidCondition1);
                                            prepaid1.prepaidCondition2 = (prepaid.prepaidCondition2 == null ? "All" : prepaid.prepaidCondition2);
                                            nullable = null;
                                            prepaid1.prepaidExpiryDate = nullable;
                                            prepaids.Add(prepaid1);
                                        }
                                    }
                                    zero.strPrepaid = JsonConvert.SerializeObject(courseDetails.prepaidAccountDetails);
                                    Cart_Details cartDetail4 = zero;
                                    if (zero.strStaffs == "[]")
                                    {
                                        str = null;
                                    }
                                    else
                                    {
                                        str = zero.strStaffs;
                                    }
                                    cartDetail4.strPrepaid = str;
                                }
                            }
                            zero.prepaidAccountDetails = courseDetails.prepaidAccountDetails;
                            zero.holdItemQty           = (courseDetails.holdItemQty.IsNullOrZero() ? new int?(0) : courseDetails.holdItemQty);
                            if (str4 != "ALL")
                            {
                                if (!item1.taxable)
                                {
                                    continue;
                                }
                                zero.gstAmountCollected = Utility.GetGST(flag, zero.itemAmount, one);
                            }
                            else
                            {
                                zero.gstAmountCollected = Utility.GetGST(flag, zero.itemAmount, one);
                            }
                        }
                        list.AddRange(
                            from f in cartDetails
                            where f.lineType == "TD"
                            select f);
                        app.bsms.api.Service.Parameters.Clear();
                        app.bsms.api.Service.Parameters.Add("siteCode", ((app.bsms.Models.Account.User)base.Session["Login_Details"]).siteCode);
                        app.bsms.api.Service.Parameters.Add("userId", ((app.bsms.Models.Account.User)base.Session["Login_Details"]).userID);
                        Temp_Cart tempCart = app.bsms.api.Service.Get <Temp_Cart>("itemCart");
                        if (tempCart.userID == null)
                        {
                            tempCart = new Temp_Cart()
                            {
                                userID     = ((app.bsms.Models.Account.User)base.Session["Login_Details"]).userID,
                                siteCode   = ((app.bsms.Models.Account.User)base.Session["Login_Details"]).siteCode,
                                staffCode  = ((app.bsms.Models.Account.User)base.Session["Login_Details"]).staffCode,
                                macAddress = base.Request.ServerVariables["REMOTE_ADDR"]
                            };
                        }
                        tempCart.transactionDetails = list;
                        tempCart.totalQuantity      = tempCart.transactionDetails.Sum <Cart_Details>((Cart_Details f) => f.itemQty);
                        tempCart.totalAmount        = tempCart.transactionDetails.Sum <Cart_Details>((Cart_Details f) => f.itemAmount);
                        tempCart.depositAmount      = tempCart.transactionDetails.Sum <Cart_Details>((Cart_Details f) => ((!f.depositAmount.HasValue ? new decimal?(new decimal()) : f.depositAmount)).Value);
                        tempCart.payDetails         = new List <app.bsms.Models.Sales.Post.Payment_Details>();
                        app.bsms.api.Service.Parameters.Clear();
                        JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings()
                        {
                            ContractResolver = new NullToEmptyStringResolver()
                        };
                        app.bsms.api.Service.Post <Temp_Cart>("itemCart", JsonConvert.SerializeObject(tempCart, jsonSerializerSetting));
                    }
                    else
                    {
                        action = base.RedirectToAction("Empty", "Cart");
                        return(action);
                    }
                }
                if (Convert.ToString(collection["callBy"]) == "COURSE" || Convert.ToString(collection["callBy"]) == "PREPAID")
                {
                    action = base.Json("Success", JsonRequestBehavior.AllowGet);
                }
                else
                {
                    action = base.RedirectToAction("Index", "Cart");
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(action);
        }
    /// <summary>
    /// Method wil be used to verify product license information.
    /// </summary>
    /// <param name="ProID">Product ID</param>
    /// <param name="ProKey">Product Key</param>
    /// <param name="ProCode">Product Code</param>
    /// <returns>Retuen boolean</returns>
    public static bool GetLicenseInfo(string ProID = null, string ProKey = null, string ProCode = null)
    {
        bool    Flag          = false;
        string  ProductID     = string.Empty;
        string  strCode       = string.Empty;
        string  key           = string.Empty;
        string  OldCode       = string.Empty;
        Prepaid objPrepaid    = new Prepaid();
        DataSet dsProductInfo = new DataSet();

        try
        {
            dsProductInfo = GetProductInfoFromXML();
            if (dsProductInfo.Tables.Count > 0 & dsProductInfo != null)
            {
                if (dsProductInfo.Tables[0].Rows.Count > 0)
                {
                    OldCode = dsProductInfo.Tables[0].Rows[0]["OldCode"].ToString();
                }
            }

            if (ProID == null & ProKey == null & ProCode == null)
            {
                ProductID = GetProductID();
                if (dsProductInfo.Tables.Count > 0 & dsProductInfo != null)
                {
                    if (dsProductInfo.Tables[0].Rows.Count > 0)
                    {
                        strCode = dsProductInfo.Tables[0].Rows[0]["Code"].ToString();
                        key     = dsProductInfo.Tables[0].Rows[0]["ProductKey"].ToString();
                    }
                }
            }
            else
            {
                ProductID = ProID;
                key       = ProKey;
                strCode   = ProCode;
            }



            if (strCode == string.Empty & key == string.Empty)
            {
                Flag = false;
            }
            else
            {
                if (strCode == objPrepaid.GetSystemInfo(ProductID, OldCode))
                {
                    enmErrorCode ErrorCode = new VarnindraClient.enmErrorCode();
                    ErrorCode = objPrepaid.CheckRegistration(strCode, key.Replace(" - ", ""), ProductID, DateTime.Now, "0", "0");

                    switch (ErrorCode.ToString())
                    {
                    case "Invalid_Product_ID":
                        Flag = false;
                        break;

                    case "InvalidKey":
                        Flag = false;
                        break;

                    case "Invalid_Count1":
                        Flag = false;
                        break;

                    case "Invalid_Count2":
                        Flag = false;
                        break;

                    case "Invalid_Start_Date":
                        Flag = false;
                        break;

                    case "No_Error":
                        Flag = true;
                        break;
                    }
                }
                else
                {
                    Flag = false;
                }
            }
        }
        catch (Exception ex)
        {
            WebMsg.Show(ex.Message);
        }

        return(Flag);
    }
示例#19
0
        private void btnSelectAll1_Click(object sender, EventArgs e)
        {
            Prepaid prepaid = new Prepaid();

            dataGridView2.DataSource = prepaid.FindALlPrepaidPayment();
        }