Esempio n. 1
0
 public CompanyDto(Company company)
 {
     _CompanyId = company.ID;
     _CurrencyId = company.CurrencyId;
     _CompanyName = company.CompanyName;
     _CompanyShortName = company.CompanyShortName;
     _LogoImage = company.LogoImage;
     _Terms = company.Terms;
     _IsActive = company.IsActive;
 }
Esempio n. 2
0
 public void DoUpdate(int ID, string name, string shortName, int currencyId, string logoImage, string terms, bool isActive)
 {
     Company company = new Company().GetById(ID, true);
      company.CompanyName = name;
      company.CompanyShortName = shortName;
      if (currencyId != 0)
          company.CurrencyId = currencyId;
      company.LogoImage = logoImage;
      company.Terms = terms;
      company.IsActive = isActive;
      company.Update();
 }
Esempio n. 3
0
 public void DoInsert(string name, string shortName, int currencyId, string logoImage, string terms, bool isActive)
 {
     Company company = new Company();
      company.CompanyName = name;
      company.CompanyShortName = shortName;
      if (currencyId != 0)
          company.CurrencyId = currencyId;
      company.LogoImage = logoImage;
      company.Terms = terms;
      company.IsActive = isActive;
      company.Create();
 }
Esempio n. 4
0
        public static Company GetCompanyByShortName(string shortName)
        {
            OQL oql = new OQL(typeof(Company));
             if (string.IsNullOrEmpty(shortName))
                 return null;

             oql.AddCondition(Condition.Eq(Company.Properties.CompanyShortName, shortName));
             CompanyList list = new Company().GetList(oql);
             if (list.Count == 1)
                 return list[0];
             else
                 return null;
        }
Esempio n. 5
0
 private void BindOperator()
 {
     Company c = new Company();
     CompanyList list = c.GetAllList();
 }
Esempio n. 6
0
 private void BindOperator()
 {
     Company c = new Company();
     CompanyList clist = c.GetAllList();
     this.ddlOperator.DataSource = clist;
     this.ddlOperator.DataTextField = "FullName";
     this.ddlOperator.DataValueField = "ID";
     this.ddlOperator.DataBind();
     this.ddlOperator.Items.Insert(0, new ListItem("-- Show All --", "0"));
 }
Esempio n. 7
0
        private void UpdateOperator(int id)
        {
            string operatorName;
            string operatorShortName;
            int currencyId;
            string logoImageUrl;
            string terms;
            bool isActive;

            TextBox txtName = (TextBox)this.FV_Operator.FindControl("txtName");
            TextBox txtShortName = (TextBox)this.FV_Operator.FindControl("txtShortName");
            DropDownList ddlCurrency = (DropDownList)this.FV_Operator.FindControl("ddlCurrency");
            FileUpload fuLogoImage = (FileUpload)this.FV_Operator.FindControl("FU_Logo");
            CheckBox chkIsActiive = (CheckBox)this.FV_Operator.FindControl("chkIsActive");
            TextBox txtTerms = (TextBox)this.FV_Operator.FindControl("txtTerms");

            operatorName = (txtName == null) ? "" : (string.IsNullOrEmpty(txtName.Text) ? "" : txtName.Text);
            operatorShortName = (txtShortName == null) ? "" : (string.IsNullOrEmpty(txtShortName.Text) ? "" : txtShortName.Text);
            currencyId = (ddlCurrency == null) ? 0 : Convert.ToInt32(ddlCurrency.SelectedValue);
            logoImageUrl = (fuLogoImage == null) ? "" : (string.IsNullOrEmpty(fuLogoImage.FileName) ? "" : fuLogoImage.FileName);
            terms = (txtTerms == null) ? "" : (string.IsNullOrEmpty(txtTerms.Text) ? "" : txtTerms.Text);
            isActive = (chkIsActiive == null) ? false : chkIsActiive.Checked;
            if (fuLogoImage.HasFile)
            {
                try
                {
                    string filePath = GetUploadPath();
                    string phyFilePath = Server.MapPath(filePath) + fuLogoImage.FileName;
                    fuLogoImage.SaveAs(phyFilePath);
                }
                catch (Exception e)
                {
                    this.lblMessage.Text = "Upload logo error, please try later.";
                    this.lblMessage.ForeColor = Color.Red;
                    return;
                }
            }
            Company company = new Company();
            company.DoUpdate(id,operatorName, operatorShortName, currencyId, logoImageUrl, terms, isActive);
            BindList();

            this.lblMessage.Text = "Update successfully";
            this.lblMessage.ForeColor = Color.Green;
        }
Esempio n. 8
0
 public void DoDelete(int ID)
 {
     Company company = new Company().GetById(ID, false);
      company.Delete();
 }