Exemplo n.º 1
0
 public DsMaster.COMPANYDataTable GetCompanies(bool isdefault = false,bool useothercomp=false,string othercon="p")
 {
     var ta = new DsMasterTableAdapters.COMPANYTableAdapter() {Connection = {ConnectionString = useothercomp? othercon: _constr}};
     var ds = new DsMaster().COMPANY;
     if (isdefault)
         ta.FillByISDEFAULT(ds);
     else
         ta.Fill(ds);
     return ds;
 }
Exemplo n.º 2
0
 public string DoSave()
 {
     string retval;
     try
     {
         var cn = new SqlConnection {ConnectionString = _constr};
         cn.Open();
         var dt = new DsMaster().COMPANY;
         bool isnew = false;
         var ta = new DsMasterTableAdapters.COMPANYTableAdapter {Connection = cn};
         ta.Fill(dt);
         var dr = dt.FindByCCODE(CompanyRow.CCODE);
         if (dr != null)
         {
             dr.BeginEdit();
             dr.EUSERID = Utils.Userid;
             dr.EDATE = DateTime.Now.Date;
         }
         else
         {
             dr = (DsMaster.COMPANYRow) dt.NewRow();
             isnew = true;
             dr.CUSERID = Utils.Userid;
             dr.CDATE = DateTime.Now.Date;
         }
         dr.COMPNAME = CompanyRow.COMPNAME;
         dr.COMPADD = CompanyRow.COMPADD;
         dr.CITY = CompanyRow.CITY;
         dr.COUNTRY = CompanyRow.COUNTRY;
         dr.TELEPHONE = CompanyRow.TELEPHONE;
         dr.FAX = CompanyRow.FAX;
         dr.EMAIL = CompanyRow.EMAIL;
         dr.WEB = CompanyRow.WEB;
         dr.BUSTYPEID = CompanyRow.BUSTYPEID;
         dr.CURRID = CompanyRow.CURRID;
         dr.CCODE = CompanyRow.CCODE;
         dr.ISDEFAULT = CompanyRow.ISDEFAULT;
         if (isnew)
         {
             dt.Rows.Add(dr);
             ta.Update(dt);
         }
         else
         {
             dr.EndEdit();
             ta.Update(dt);
         }
         retval = "1";
     }
     catch (Exception ex)
     {
         retval = ex.ToString();
     }
     return retval;
 }