예제 #1
0
        /// <summary>
        /// 根据WebService同步汇率
        /// </summary>
        /// <param name="rate">汇率</param>
        /// <param name="jiancheng">币种简称</param>
        /// <returns>返回影响行数</returns>
        public static bool UpdCurrencyRateAll(IList <CurrencyModel> currs)
        {
            using (SqlConnection conn = new SqlConnection(DBHelper.connString))
            {
                conn.Open();
                SqlTransaction tr = conn.BeginTransaction();//开启事务

                try
                {
                    foreach (CurrencyModel curr in currs)
                    {
                        if (CurrencyDAL.UpdCurrencyRateByJC(tr, curr.Rate, curr.JianCheng) != 1)
                        {
                            tr.Rollback();
                            return(false);
                        }
                    }

                    tr.Commit();
                    return(true);
                }
                catch
                {
                    tr.Rollback();
                }
                finally
                {
                    conn.Close();
                }
            }

            return(false);
        }
예제 #2
0
        private void ReadWriteCSVFile()
        {
            string date = System.DateTime.Now.ToString("ddMMyyhhmmss");

            if (File.Exists(Server.MapPath(uppath)))
            {
                StreamReader           sr      = new StreamReader(Server.MapPath(uppath));
                StreamWriter           write   = new StreamWriter(Server.MapPath(output));
                CsvReader              csvread = new CsvReader(sr);
                CsvWriter              csw     = new CsvWriter(write);
                IEnumerable <Currency> record  = csvread.GetRecords <Currency>();

                foreach (var rec in record) // Each record will be fetched and printed on the screen
                {
                    csw.WriteRecord <Currency>(rec);
                    csw.NextRecord();
                    CurrencyDAL currencyDAL = new CurrencyDAL();
                    currencyDAL.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString();
                    currencyDAL.InsertCurrency(rec);
                }
                sr.Close();
                write.Close();//close file streams

                if (File.Exists(Server.MapPath(uppath)))
                {
                    File.Delete(Server.MapPath(uppath));
                }
            }
        }
예제 #3
0
        protected void btnAddNewCurr_Click(object sender, EventArgs e)
        {
            string confirmValue = Request.Form["confirm_value"];

            if (confirmValue == "Yes")
            {
                //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked YES!')", true);
            }
            else
            {
                //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked NO!')", true);
            }
            CurrencyDAL currencyDAL = new CurrencyDAL();
            Currency    com         = new Currency();

            currencyDAL.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString();
            com.Name            = tbCurrncyName.Text;
            com.Country         = (tbCountry.Text);
            com.PointValue_Rate = Convert.ToDouble(tbPointValue_Rate.Text);
            com.USDRate         = Convert.ToDouble(tbusdrate.Text);
            com.ISO             = (tbISO.Text);


            currencyDAL.InsertCurrency(com);
            gvCurrency.EditIndex   = -1;
            tbCurrncyName.Text     = string.Empty;
            tbCountry.Text         = string.Empty;
            tbPointValue_Rate.Text = string.Empty;
            tbusdrate.Text         = string.Empty;
            GetCurrency();
        }
예제 #4
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(hdCurrencyID.Value))
        {
            CurrencyDAL oCurrencyDAL = new CurrencyDAL();
            Result      oResult      = (Result)oCurrencyDAL.Detete(hdCurrencyID.Value);
            if (oResult.Status)
            {
                this.LoadList();
                this.ClearTextValue();
                hdCurrencyID.Value = string.Empty;

                ucMessage.OpenMessage(Constants.MSG_SUCCESS_DELETE, Constants.MSG_TYPE_SUCCESS);
            }
            else
            {
                if (oResult.Message.Equals(Constants.TABLE_MAIN))
                {
                    ucMessage.OpenMessage(Constants.MSG_APPROVED_DELETE_DATA, Constants.MSG_TYPE_ERROR);
                }
                else
                {
                    ucMessage.OpenMessage(Constants.MSG_ERROR_DELETE, Constants.MSG_TYPE_ERROR);
                }
            }
        }
        else
        {
            ucMessage.OpenMessage(Constants.MSG_ERROR_DELETE, Constants.MSG_TYPE_ERROR);
        }
    }
예제 #5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Currency    oCurrency    = new Currency();
        CurrencyDAL oCurrencyDAL = new CurrencyDAL();

        oCurrency.CurrencyID     = Request[txtCurrencyID.UniqueID].Trim().ToUpper();
        txtCurrencyID.Text       = Request[txtCurrencyID.UniqueID].Trim().ToUpper();
        oCurrency.CurrencyCode   = txtCurrencyCode.Text;
        oCurrency.CurrencyDesc   = txtDescription.Text;
        oCurrency.CurrencySymbol = txtCurrencySymbol.Text;

        oCurrency.UserDetails = ucUserDet.UserDetail;

        oCurrency.UserDetails.MakeDate = DateTime.Now;
        ucUserDet.ResetData();
        Result oResult = (Result)oCurrencyDAL.Save(oCurrency);

        if (oResult.Status)
        {
            this.LoadList();
            this.ClearTextValue();
            hdCurrencyID.Value = string.Empty;

            ucMessage.OpenMessage(Constants.MSG_SUCCESS_SAVE, Constants.MSG_TYPE_SUCCESS);
        }
        else
        {
            ucMessage.OpenMessage(Constants.MSG_ERROR_SAVE, Constants.MSG_TYPE_ERROR);
        }
    }
예제 #6
0
 public SearchFlightsLogic(CurrencyDAL currenciesDAL, Airport_IATA_CodesDAL airport_IATA_CodesDAL, SearchParametersDAL searchParametersDAL, SearchResultsDAL searchResultsDAL, LowFlightFareHub lowFlightFareHub)
 {
     _CurrencyDAL           = currenciesDAL;
     _Airport_IATA_CodesDAL = airport_IATA_CodesDAL;
     _SearchParametersDAL   = searchParametersDAL;
     _SearchResultsDAL      = searchResultsDAL;
     _LowFlightFareHub      = lowFlightFareHub;
 }
예제 #7
0
 protected void gvCurrency_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteCurrency")
     {
         CurrencyDAL currencyDAL = new CurrencyDAL();
         currencyDAL.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString();
         currencyDAL.DeleteCurrency(e.CommandArgument.ToString());
         GetCurrency();
     }
 }
        protected void FetchCurrency()
        {
            CurrencyDAL currencyDAL = new CurrencyDAL
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };

            GVCurrency.DataSource = currencyDAL.GetCurrency();
            GVCurrency.DataBind();
        }
예제 #9
0
        private void GetCurrency()
        {
            CurrencyDAL currencyDAL = new CurrencyDAL();

            currencyDAL.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString();
            List <Currency> CurrencyList = currencyDAL.GetCurrency();

            gvCurrency.DataSource = CurrencyList;
            gvCurrency.DataBind();
        }
예제 #10
0
        public frmBankAccount()
        {
            InitializeComponent();

            DALObject        = new BankAccountDAL();
            BankNameDALObj   = new BankNameDAL();
            BankBranchDALObj = new BankBranchDAL();
            CurrencyDALObj   = new CurrencyDAL();

            FirstControl = txtBankAcNo;
        }
        protected void GVCurrency_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            CurrencyDAL currencyDAL = new CurrencyDAL {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };
            string IDString = GVCurrency.DataKeys[e.RowIndex].Values["ID"].ToString();

            currencyDAL.DeleteCurrency(IDString);
            GVCurrency.EditIndex = -1;

            FetchCurrency();
        }
예제 #12
0
파일: AddOrderBLL.cs 프로젝트: 892182825/SP
        /// <summary>
        /// 绑定货币(货币名称 -- 汇率)列表
        /// </summary>
        /// <param name="list">要添加期数的控件</param>
        public static void BindCurrency_Rate(DropDownList list)
        {
            list.Items.Clear();

            List <CurrencyModel> currencyModelList = AddFreeOrderDAL.GetRateAndName();

            foreach (CurrencyModel model in currencyModelList)
            {
                ListItem list2 = new ListItem(model.Name, model.ID.ToString());
                list.Items.Add(list2);
            }
            list.SelectedValue = CurrencyDAL.GetDefaultCurrencyId().ToString();
        }
예제 #13
0
        public static async Task <IEnumerable <CurrencyBO> > GetCurrenciesAsync(provider provider)
        {
            Task t = Task.Factory.StartNew(() => CurrencyUpdater.UpdateCurrencies(provider));

            t.Wait();

            IEnumerable <CurrencyDO> Currencies = await CurrencyDAL.GetCurrenciesAsync(provider);

            return(Currencies.Select(x => new CurrencyBO()
            {
                CurrencyLastUpdate = x.CurrencyLastUpdate,
                CurrencyName = x.CurrencyName,
                CurrencyService = x.CurrencyService,
                CurrencyValue = x.CurrencyValue
            }).ToList());
        }
예제 #14
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            CustomerType oCustomerType = new CustomerType();
            Result       oResult       = new Result();

            if (Type.Equals("BankSearch"))
            {
                BankDAL oBDAL = new BankDAL();
                oResult = oBDAL.AppSearchList(txtID.Text, txtName.Text);
            }
            else if (Type.Equals("DivisionSearch"))
            {
                DivisionDAL oDivisionDAL = new DivisionDAL();
                oResult = oDivisionDAL.AppSearchList(txtID.Text, txtName.Text);
            }
            else if (Type.Equals("CurrencySearch"))
            {
                CurrencyDAL oCurrencyDAL = new CurrencyDAL();
                oResult = oCurrencyDAL.AppSearchList(txtID.Text, txtName.Text);
            }
            else if (Type.Equals("BranchSearch"))
            {
                BranchDAL oBranchDAL = new BranchDAL();
                oResult = oBranchDAL.AppSearchList(txtID.Text, txtName.Text);
            }

            ScriptManager.RegisterStartupScript(this.upGv, typeof(string), Constants.POPUP_WINDOW, " HideProgressStatus('ctl00_cphDet_ucSearchConfComm_lblProgress') ", true);
            if (oResult.Status)
            {
                DataTable dtTmpCustomerTypeList = (DataTable)oResult.Return;
                if (dtTmpCustomerTypeList.Rows.Count > 0)
                {
                    gvSearchList.DataSource = dtTmpCustomerTypeList;
                    gvSearchList.DataBind();
                }
                else
                {
                    gvSearchList.DataSource = null;
                    gvSearchList.DataBind();
                }
                Session[Constants.SES_CONFIG_APPROVE_DATA] = dtTmpCustomerTypeList;
            }

            ScriptManager.RegisterStartupScript(this.upGv, typeof(string), Constants.POPUP_WINDOW, " HideProgressStatus('ctl00_cphDet_ucSearchConfComm_lblProgress') ", true);
        }
예제 #15
0
        protected void gvCurrency_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            CurrencyDAL currencyDAL = new CurrencyDAL();

            currencyDAL.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString();
            Currency com = new Currency();

            com.ID              = Convert.ToInt32((gvCurrency.DataKeys[e.RowIndex].Values["ID"]));
            com.Name            = (gvCurrency.Rows[e.RowIndex].FindControl("tbCurrName") as TextBox).Text;
            com.Country         = (gvCurrency.Rows[e.RowIndex].FindControl("tbCountry") as TextBox).Text;
            com.PointValue_Rate = Convert.ToDouble((gvCurrency.Rows[e.RowIndex].FindControl("tbPointValue_Rate") as TextBox).Text);
            com.USDRate         = Convert.ToDouble((gvCurrency.Rows[e.RowIndex].FindControl("tbusdrate") as TextBox).Text);
            com.ISO             = (gvCurrency.Rows[e.RowIndex].FindControl("tbISO") as TextBox).Text;

            currencyDAL.UpdateCurrency(com);
            gvCurrency.EditIndex = -1;
            GetCurrency();
        }
예제 #16
0
        protected void BtnExport_Click(object sender, EventArgs e)
        {
            CurrencyDAL currencyDAL = new CurrencyDAL();
            Currency    com         = new Currency();

            currencyDAL.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString();
            List <Currency> CurrncyList = currencyDAL.GetCurrency();

            var mem       = new MemoryStream();
            var writer    = new StreamWriter(mem, Encoding.UTF8, 1024, true);
            var csvWriter = new CsvWriter(writer);


            csvWriter.Configuration.Delimiter = ",";


            csvWriter.WriteField("Name");
            csvWriter.WriteField("Country");
            csvWriter.WriteField("PointValue_Rate");
            csvWriter.WriteField("USDRate");
            csvWriter.WriteField("ISO");
            csvWriter.NextRecord();

            int lenght = CurrncyList.Count - 1;

            for (int i = 0; i <= lenght; i++)
            {
                csvWriter.WriteField(CurrncyList[i].Name);
                csvWriter.WriteField(CurrncyList[i].Country);
                csvWriter.WriteField(CurrncyList[i].PointValue_Rate);
                csvWriter.WriteField(CurrncyList[i].USDRate);
                csvWriter.WriteField(CurrncyList[i].ISO);
                csvWriter.NextRecord();
            }
            writer.Flush();
            var data = Encoding.UTF8.GetString(mem.ToArray());

            Response.Clear();
            Response.AddHeader("content-disposition", "attachment; filename=Currency.csv");
            Response.Charset     = "";
            Response.ContentType = "text/csv";
            Response.Write(data.ToString());
            Response.End();
        }
예제 #17
0
    private void LoadDataByID(string sCurrencyID)
    {
        Currency    oCurrency    = new Currency(sCurrencyID);
        CurrencyDAL oCurrencyDAL = new CurrencyDAL();
        Result      oResult      = new Result();

        oResult = oCurrencyDAL.LoadByID(oCurrency);
        if (oResult.Status)
        {
            oCurrency = (Currency)oResult.Return;

            txtCurrencyID.Text     = oCurrency.CurrencyID.Trim();
            txtCurrencyID.ReadOnly = true;
            txtCurrencyCode.Text   = oCurrency.CurrencyCode;
            txtDescription.Text    = oCurrency.CurrencyDesc;
            txtCurrencySymbol.Text = oCurrency.CurrencySymbol;
            if (string.IsNullOrEmpty(hdDataType.Value))
            {
                //When Loading from Approver End
                UserDetails userDetails = ucUserDet.UserDetail;
                userDetails.MakerID  = oCurrency.UserDetails.MakerID;
                userDetails.MakeDate = oCurrency.UserDetails.MakeDate;
                ucUserDet.UserDetail = userDetails;
            }
            else if (hdDataType.Value.Equals("T"))
            {
                //When loading from temp table
                UserDetails userDetails = ucUserDet.UserDetail;
                userDetails.CheckDate      = oCurrency.UserDetails.CheckDate;
                userDetails.CheckerID      = oCurrency.UserDetails.CheckerID;
                userDetails.CheckDate      = oCurrency.UserDetails.CheckDate;
                userDetails.CheckerComment = oCurrency.UserDetails.CheckerComment;
                ucUserDet.UserDetail       = userDetails;
            }

            hdCurrencyID.Value = sCurrencyID;
        }
        else
        {
            ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_ERROR);
        }
    }
예제 #18
0
        private void updateCurrency(Currency currency)
        {
            int _result = 0;

            switch (_mode)
            {
            case DataActionMode.Add:
                _result = new CurrencyDAL().addCurrency(currency);
                break;

            case DataActionMode.Edit:
                _result = new CurrencyDAL().updateCurrency(currency);
                break;
            }

            if (_result > 0)
            {
                MessageBox.Show("Update record successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        protected void GVCurrency_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            CurrencyDAL currencyDAL = new CurrencyDAL
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };

            Currency currency = new Currency
            {
                ID              = Int32.Parse((GVCurrency.Rows[e.RowIndex].FindControl("LblCurrencyID") as Label).Text),
                Name            = (GVCurrency.Rows[e.RowIndex].FindControl("txtCurrencyName") as TextBox).Text,
                Country         = (GVCurrency.Rows[e.RowIndex].FindControl("DDLCurrencyCountry") as DropDownList).Text,
                PointValue_Rate = Double.Parse((GVCurrency.Rows[e.RowIndex].FindControl("TxtCurrencyPVR") as TextBox).Text),
                USDRate         = Double.Parse((GVCurrency.Rows[e.RowIndex].FindControl("TxtCurrencyUSD") as TextBox).Text),
                ISO             = (GVCurrency.Rows[e.RowIndex].FindControl("TxtCurrencyISO") as TextBox).Text
            };

            currencyDAL.UpdateCurrency(currency);
            GVCurrency.EditIndex = -1;

            FetchCurrency();
        }
예제 #20
0
    public void LoadList()
    {
        Config oConfig = (Config)Session[Constants.SES_USER_CONFIG];

        if (oConfig != null)
        {
            Currency    oCurrency    = new Currency();
            CurrencyDAL oCurrencyDAL = new CurrencyDAL();
            Result      oResult      = oCurrencyDAL.LoadUnapprovedList(oConfig.UserName, false);

            if (oResult.Status)
            {
                DataTable dtTmpCurrencyList = (DataTable)oResult.Return;
                if (dtTmpCurrencyList.Rows.Count > 0)
                {
                    dtTmpCurrencyList.Columns.Remove("MakerID");

                    Session[Constants.SES_CONFIG_UNAPPROVE_DATA] = dtTmpCurrencyList;


                    gvList.DataSource = dtTmpCurrencyList;
                    gvList.DataBind();
                }
                else
                {
                    gvList.DataSource = null;
                    gvList.DataBind();
                }
            }
            else
            {
                ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_ERROR);
            }
        }
        else
        {
            ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_ERROR);
        }
    }
        protected void BtnInsertCurrency_Click(object sender, EventArgs e)
        {
            CurrencyDAL currencyDAL = new CurrencyDAL
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };

            Currency currency = new Currency
            {
                Name            = TxtAddCurrencyName.Text,
                Country         = DDLAddCurrencyCountry.Text,
                PointValue_Rate = Double.Parse(TxtAddCurrencyPVR.Text),
                USDRate         = Double.Parse(TxtAddCurrencyUSD.Text),
                ISO             = TxtAddCurrencyISO.Text
            };

            currencyDAL.InsertCurrency(currency);
            GVCurrency.EditIndex = -1;

            ResetControls();
            FetchCurrency();
        }
예제 #22
0
    protected void btnApprove_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(hdCurrencyID.Value))
        {
            Currency    oCurrency    = new Currency(hdCurrencyID.Value);
            CurrencyDAL oCurrencyDAL = new CurrencyDAL();
            oCurrency.UserDetails = ucUserDet.UserDetail;

            Result oResult = (Result)oCurrencyDAL.Approve(oCurrency);
            if (oResult.Status)
            {
                ucMessage.OpenMessage(Constants.MSG_SUCCESS_APPROVE, Constants.MSG_TYPE_SUCCESS);
            }
            else
            {
                ucMessage.OpenMessage(Constants.MSG_ERROR_APPROVE, Constants.MSG_TYPE_ERROR);
            }
        }
        else
        {
            ucMessage.OpenMessage(Constants.MSG_ERROR_APPROVE, Constants.MSG_TYPE_ERROR);
        }
    }
예제 #23
0
 /// <summary>
 /// Get CurrencyName by currencyID
 /// </summary>
 /// <param name="currencyID">currencyID</param>
 /// <returns>return CurrencyName</returns>
 public static string GetCurrencyNameByID(int currencyID)
 {
     return(CurrencyDAL.GetCurrencyNameByID(currencyID));
 }
예제 #24
0
        public List <object> All()
        {
            CurrencyDAL <object> cd = new CurrencyDAL <object>("LoginTable");

            return(cd.GetALL());
        }
예제 #25
0
 public static int GetCountryByRateID(int ID)
 {
     return(CurrencyDAL.GetCountryByRateID(ID));
 }
예제 #26
0
 /// <summary>
 /// 删除指定的汇率记录
 /// </summary>
 /// <param name="ID">汇率ID</param>
 /// <returns>返回删除所影响的行数</returns>
 public static int DelCurrencyByID(int ID)
 {
     return(CurrencyDAL.DelCurrencyByID(ID));
 }
예제 #27
0
 /// <summary>
 ///向汇率表中插入记录
 /// </summary>
 /// <param name="currencyName">币种名称</param>
 /// <returns> 返回向汇率表中插入记录所影响的行数</returns>
 public static int AddCurrency(string currencyName, out int id)
 {
     return(CurrencyDAL.AddCurrency(currencyName, out id));
 }
예제 #28
0
 /// <summary>
 /// Out to excel of the all data of Currency
 /// </summary>
 /// <returns>Return DataTable Object</returns>
 public static DataTable OutToExcel_Currency()
 {
     return(CurrencyDAL.OutToExcel_Currency());
 }
예제 #29
0
 /// <summary>
 /// 获取汇率表中部分汇率ID和币种名称
 /// </summary>
 /// <returns>返回SqlDataReader对象</returns>
 public static IList <Model.CurrencyModel> GetPartCurrencyIDName()
 {
     return(CurrencyDAL.GetPartCurrencyIDName());
 }
예제 #30
0
 /// <summary>
 /// 通过汇率名称获取行数
 /// </summary>
 /// <param name="currencyName">汇率名称</param>
 /// <returns>返回行数</returns>
 public static int GetCurrencyCountByCurrencyName(string currencyName)
 {
     return(CurrencyDAL.GetCurrencyCountByCurrencyName(currencyName));
 }