Exemplo n.º 1
0
        private void NewBill()
        {
            try
            {
                if (Orders.Count > 0 && OrderSummary.BillNo == 0)
                {
                    MessageBoxResult result = System.Windows.MessageBox.Show("Are you sure you want to create New Bill?", "Warning Message", MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.No);
                    if (result == MessageBoxResult.No || result == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }
                Orders.Clear();
                SelectedPaymentMode = null;
                SelectedPaymentMode = new PaymentMode();
                SelectedPaymentMode = PaymentModes.Where(x => x.PaymentModeId == 1).FirstOrDefault();

                NotifyPropertyChanged("SelectedPaymentMode");
                OrderSummary.Clear();
                Customer.Clear();
                Add();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Occured: " + ex.Message + " " + ex.Source + " " + ex.StackTrace);
            }
        }
        public PaymentModesResponse Post(PaymentModes request)
        {
            if (request.PaymentMode.Id > 0)
              {
            Bm2s.Data.Common.BLL.Trade.PaymentMode item = Datas.Instance.DataStorage.PaymentModes[request.PaymentMode.Id];
            item.Code = request.PaymentMode.Code;
            item.EndingDate = request.PaymentMode.EndingDate;
            item.Name = request.PaymentMode.Name;
            item.StartingDate = request.PaymentMode.StartingDate;
            Datas.Instance.DataStorage.PaymentModes[request.PaymentMode.Id] = item;
              }
              else
              {
            Bm2s.Data.Common.BLL.Trade.PaymentMode item = new Data.Common.BLL.Trade.PaymentMode()
            {
              Code = request.PaymentMode.Code,
              EndingDate = request.PaymentMode.EndingDate,
              Name = request.PaymentMode.Name,
              StartingDate = request.PaymentMode.StartingDate
            };

            Datas.Instance.DataStorage.PaymentModes.Add(item);
            request.PaymentMode.Id = item.Id;
              }

              PaymentModesResponse response = new PaymentModesResponse();
              response.PaymentModes.Add(request.PaymentMode);
              return response;
        }
Exemplo n.º 3
0
        public PaymentModes Update(string json, string ownerId)
        {
            PaymentModes paymentMode = JsonConvert.DeserializeObject <PaymentModes>(json);

            paymentMode.OwnerId = ownerId;
            collections.Save(paymentMode);
            return(paymentMode);
        }
Exemplo n.º 4
0
        public PaymentModes Insert(string json, string ownerId)
        {
            PaymentModes paymentMode = JsonConvert.DeserializeObject <PaymentModes>(json);

            paymentMode._id     = Guid.NewGuid();
            paymentMode.OwnerId = ownerId;
            collections.Save(paymentMode);
            return(paymentMode);
        }
Exemplo n.º 5
0
    private void BindPendingPaymentModes()
    {
        DataTable table = new PaymentModes().SelectAll();

        drpPendingPaymentMode.DataSource     = table;
        drpPendingPaymentMode.DataTextField  = table.Columns["PaymentMode"].ToString();
        drpPendingPaymentMode.DataValueField = table.Columns["PaymentMode_ID"].ToString();
        drpPendingPaymentMode.DataBind();
    }
        public ActionResult Edit(AirlineCappingModel model, Int64 id)
        {
            model.cappingId = id;

            var gdsList = ent.ServiceProviders.ToList();
            ServiceProviders gdsSelect = new ServiceProviders()
            {
                ServiceProviderId = -1, ServiceProviderName = "--Select--"
            };

            gdsList.Insert(0, gdsSelect);

            var      airLineList   = ent.Airlines.ToList();
            Airlines airlineSelect = new Airlines()
            {
                AirlineId = -1, AirlineName = "--Select--"
            };

            airLineList.Insert(0, airlineSelect);

            var   bankList   = ent.Banks.ToList();
            Banks bankSelect = new Banks()
            {
                BankId = -1, BankName = "--Select--"
            };

            bankList.Insert(0, bankSelect);

            var          paymentList   = ent.PaymentModes.ToList();
            PaymentModes paymentSelect = new PaymentModes()
            {
                PaymentModeId = -1, ModeName = "--Select--"
            };

            paymentList.Insert(0, paymentSelect);

            ViewData["GDSList"]         = gdsList;     //defaultProvider.GetGDSInformationList();
            ViewData["AirlineList"]     = airLineList; //defaultProvider.GetAirlineList();
            ViewData["BankList"]        = bankList;    //defaultProvider.GetBankList();
            ViewData["PaymentModeList"] = paymentList; //defaultProvider.GetPaymentModeList();

            //ViewData["GDSList"] = defaultProvider.GetGDSInformationList();
            //ViewData["AirlineList"] = defaultProvider.GetAirlineList();
            //ViewData["BankList"] = defaultProvider.GetBankList();
            //ViewData["PaymentModeList"] = defaultProvider.GetPaymentModeList();

            if (ModelState.IsValid)
            {
                airlineCappingProvider.Edit(model);
                return(View(model));
            }
            else
            {
                return(View());
            }
        }
        public PaymentModesResponse Delete(PaymentModes request)
        {
            Bm2s.Data.Common.BLL.Trade.PaymentMode item = Datas.Instance.DataStorage.PaymentModes[request.PaymentMode.Id];
              item.EndingDate = DateTime.Now;
              Datas.Instance.DataStorage.PaymentModes[item.Id] = item;

              PaymentModesResponse response = new PaymentModesResponse();
              response.PaymentModes.Add(request.PaymentMode);
              return response;
        }
    private void BindPaymentModes()
    {
        DataTable table = new PaymentModes().SelectAll();

        drpPaymentModes.DataSource     = table;
        drpPaymentModes.DataTextField  = table.Columns["PaymentMode"].ToString();
        drpPaymentModes.DataValueField = table.Columns["PaymentMode_ID"].ToString();
        drpPaymentModes.DataBind();
        drpPaymentModes.Items.Insert(0, new ListItem("Select a Payment Mode...", "-1"));
    }
Exemplo n.º 9
0
    private void BindPaymenModes()
    {
        drpPaymentModes.ClearSelection();
        DataTable table = new PaymentModes().SelectAll();

        drpPaymentModes.DataSource     = table;
        drpPaymentModes.DataTextField  = table.Columns["PaymentMode"].ToString();
        drpPaymentModes.DataValueField = table.Columns["PaymentMode_ID"].ToString();
        drpPaymentModes.DataBind();
    }
Exemplo n.º 10
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string error = string.Empty;

            Model.PaymentModes paymentmode = new PaymentModes();
            paymentmode.Id          = this.txtNumber.Text.Trim();
            paymentmode.PaymentMode = this.txtPaymentMode.Text.Trim();
            if (string.IsNullOrEmpty(paymentmode.Id) || string.IsNullOrEmpty(paymentmode.PaymentMode))
            {
                lbSubmit.Text = "请将带*号的内容填写完整!";
                return;
            }
            if (PaymentModeManager.CheckHave(paymentmode.PaymentMode))
            {
                lbSubmit.Text = "已经有该付款方式,请重新填写!";
                return;
            }
            else
            {
                bool result;
                if (btnSubmit.Text.Equals("添加"))
                {
                    result        = PaymentModeManager.AddPaymentMode(paymentmode, ref error);
                    lbSubmit.Text = result == true ? "添加成功" : "添加失败!原因:" + error;
                    if (result)
                    {
                        Tool.WriteLog(Tool.LogType.Operating, "增加付款方式" + paymentmode.Id, "增加成功");
                        ToolCode.Tool.ResetControl(this.Controls);
                        return;
                    }
                    else
                    {
                        Tool.WriteLog(Tool.LogType.Operating, "增加付款方式" + paymentmode.Id, "增加失败!原因" + error);
                        return;
                    }
                }
                else
                {
                    result        = PaymentModeManager.EditPaymentMode(paymentmode, ref error);
                    lbSubmit.Text = result == true ? "修改成功" : "修改失败!原因:" + error;
                    if (result)
                    {
                        Tool.WriteLog(Tool.LogType.Operating, "编辑付款方式" + paymentmode.Id, "编辑成功");
                        lbSubmit.Text = "修改成功!";
                    }
                    else
                    {
                        Tool.WriteLog(Tool.LogType.Operating, "编辑付款方式" + paymentmode.Id, "编辑失败!原因" + error);
                        lbSubmit.Text = "修改失败!";
                        return;
                    }
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// DataTable 转对象
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public static PaymentModes ConvertDataTableToModel(string sql)
        {
            error = string.Empty;
            DataTable    dt          = SqlHelper.GetTable(sql, ref error);
            DataRow      dr          = dt.Rows[0];
            PaymentModes paymentmode = new PaymentModes();

            paymentmode.Id          = dr["Id"] == null ? "" : dr["Id"].ToString();
            paymentmode.PaymentMode = dr["PaymentMode"] == null ? "" : dr["PaymentMode"].ToString();
            return(paymentmode);
        }
Exemplo n.º 12
0
 private void UpdatePaymentMethods()
 {
     PaymentModes.Add("Cash");
     using (var context = new ERPContext())
     {
         var bankAccounts = context.Ledger_Accounts
                            .Where(account => account.Name.Contains("Bank") && !account.Name.Contains("Expense"));
         foreach (var bank in bankAccounts)
         {
             PaymentModes.Add(bank.Name);
         }
     }
 }
        public PaymentModesResponse Get(PaymentModes request)
        {
            PaymentModesResponse response = new PaymentModesResponse();
              List<Bm2s.Data.Common.BLL.Trade.PaymentMode> items = new List<Data.Common.BLL.Trade.PaymentMode>();
              if (!request.Ids.Any())
              {
            items.AddRange(Datas.Instance.DataStorage.PaymentModes.Where(item =>
              (string.IsNullOrWhiteSpace(request.Code) || item.Code.ToLower().Contains(request.Code.ToLower())) &&
              (string.IsNullOrWhiteSpace(request.Name) || item.Name.ToLower().Contains(request.Name.ToLower())) &&
              (!request.Date.HasValue || (request.Date >= item.StartingDate && (!item.EndingDate.HasValue || request.Date < item.EndingDate.Value)))
              ));
              }
              else
              {
            items.AddRange(Datas.Instance.DataStorage.PaymentModes.Where(item => request.Ids.Contains(item.Id)));
              }

              var collection = (from item in items
                        select new Bm2s.Poco.Common.Trade.PaymentMode()
                        {
                          Code = item.Code,
                          EndingDate = item.EndingDate,
                          Id = item.Id,
                          Name = item.Name,
                          StartingDate = item.StartingDate
                        }).AsQueryable().OrderBy(request.Order, !request.DescendingOrder);

              response.ItemsCount = collection.Count();
              if (request.PageSize > 0)
              {
            response.PaymentModes.AddRange(collection.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize));
              }
              else
              {
            response.PaymentModes.AddRange(collection);
              }

              try
              {
            response.PagesCount = collection.Count() / response.PaymentModes.Count + (collection.Count() % response.PaymentModes.Count > 0 ? 1 : 0);
              }
              catch
              {
            response.PagesCount = 1;
              }

              return response;
        }
Exemplo n.º 14
0
        public List <PaymentModes> GetAllPaymentModes()
        {
            List <PaymentModes> PaymentModesList = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[Accounts].[GetAllPaymentModes]";
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                PaymentModesList = new List <PaymentModes>();
                                while (sdr.Read())
                                {
                                    PaymentModes _pmObj = new PaymentModes();
                                    {
                                        _pmObj.Code        = (sdr["Code"].ToString() != "" ? (sdr["Code"].ToString()) : _pmObj.Code);
                                        _pmObj.Description = (sdr["Description"].ToString() != "" ? sdr["Description"].ToString() : _pmObj.Description);
                                    }
                                    PaymentModesList.Add(_pmObj);
                                }
                            }
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }

            return(PaymentModesList);
        }
Exemplo n.º 15
0
        private void LoadPage()
        {
            string sql   = string.Empty;
            string error = string.Empty;

            if (ToolManager.CheckQueryString("Id"))
            {
                sql = string.Format(@" select * from PaymentMode where Id='{0}' ", ToolManager.GetQueryString("Id"));
                //sql = string.Format(@" select * from PaymentMode where Id='{0}' ", "1");
                this.trNumber.Visible = false;
                PaymentModes paymentmodel = PaymentModeManager.ConvertDataTableToModel(sql);
                this.txtNumber.Text      = paymentmodel.Id;
                this.txtPaymentMode.Text = paymentmodel.PaymentMode;
                btnSubmit.Text           = "修改";
            }
            else
            {
                btnSubmit.Text = "添加";
            }
        }
        public ActionResult Create()
        {
            var gdsList = ent.ServiceProviders.OrderBy(x => x.ServiceProviderName).ToList();
            ServiceProviders gdsSelect = new  ServiceProviders()
            {
                ServiceProviderId = -1, ServiceProviderName = "--Select--"
            };

            gdsList.Insert(0, gdsSelect);

            var      airLineList   = ent.Airlines.ToList();
            Airlines airlineSelect = new Airlines()
            {
                AirlineId = -1, AirlineName = "--Select--"
            };

            airLineList.Insert(0, airlineSelect);

            var   bankList   = ent.Banks.ToList();
            Banks bankSelect = new Banks()
            {
                BankId = -1, BankName = "--Select--"
            };

            bankList.Insert(0, bankSelect);

            var          paymentList   = ent.PaymentModes.ToList();
            PaymentModes paymentSelect = new PaymentModes()
            {
                PaymentModeId = -1, ModeName = "--Select--"
            };

            paymentList.Insert(0, paymentSelect);

            ViewData["GDSList"]         = gdsList;     //defaultProvider.GetGDSInformationList();
            ViewData["AirlineList"]     = airLineList; //defaultProvider.GetAirlineList();
            ViewData["BankList"]        = bankList;    //defaultProvider.GetBankList();
            ViewData["PaymentModeList"] = paymentList; //defaultProvider.GetPaymentModeList();
            return(View());
        }
Exemplo n.º 17
0
        public PaymentModeModule()
        {
            this.RequiresAuthentication();

            Post["/createpaymentmode"] = p =>
            {
                try
                {
                    var          paymentmode = this.Request.Form.paymentmode;
                    PaymentModes paymentMode = this.PaymentModeService().Insert(paymentmode, this.CurrentAccount().OwnerId);
                    return(Response.AsJson(paymentMode));
                }
                catch (Exception e)
                {
                    return(Response.AsJson(new { error = true, message = e }));
                }
            };

            Get["/findpaymentmodebyid/{id}"] = p =>
            {
                try
                {
                    PaymentModes paymentMode = this.PaymentModeQuery().Get(p.id, this.CurrentAccount().OwnerId);
                    return(Response.AsJson(paymentMode));
                }
                catch (Exception e)
                {
                    return(Response.AsJson(new { error = true, message = e }));
                }
            };

            Get["/findallpaymentmode"] = p =>
            {
                try
                {
                    PaymentModes[] paymentModes = this.PaymentModeQuery().FindAll(this.CurrentAccount().OwnerId);
                    return(Response.AsJson(paymentModes));
                }
                catch (Exception e)
                {
                    return(Response.AsJson(new { error = true, message = e }));
                }
            };

            Post["/updatepaymentmode"] = p =>
            {
                try
                {
                    PaymentModes paymentMode = this.PaymentModeService().Update(this.Request.Form.paymentmode, this.CurrentAccount().OwnerId);
                    return(Response.AsJson(paymentMode));
                }
                catch (Exception e)
                {
                    return(Response.AsJson(new { error = true, message = e }));
                }
            };
            Post["/UpdateStatusInvoice/{id}"] = p =>
            {
                try
                {
                    Guid     invoiceId = p.id;
                    Invoices invoice   = this.InvoicesQueryRepository().FindById(invoiceId, this.CurrentAccount().OwnerId);
                    invoice.InvoiceStatusSudahLunas();

                    this.InvoiceService().Update(this.Request.Form.invoice, this.CurrentAccount().OwnerId);
                    return(Response.AsJson(new { error = false }));
                }
                catch (Exception e)
                {
                    return(Response.AsJson(new { error = true, message = e }));
                }
            };

            Post["/deletepaymentmode/{id}"] = p =>
            {
                try
                {
                    this.PaymentModeService().Delete(p.id);
                    return(Response.AsJson(new { error = false }));
                }
                catch (Exception e)
                {
                    return(Response.AsJson(new { error = true, message = e }));
                }
            };
        }
Exemplo n.º 18
0
 /// <summary>
 /// 编辑付款方式
 /// </summary>
 /// <param name="user"></param>
 /// <param name="error"></param>
 /// <returns></returns>
 public static bool EditPaymentMode(PaymentModes paymentmode, ref string error)
 {
     sql = string.Format(@" update PaymentMode set PaymentMode='{0}' where Id='{1}'", paymentmode.PaymentMode, paymentmode.Id);
     return(SqlHelper.ExecuteSql(sql, ref error));
 }