예제 #1
0
 // public DsMaster.STOREMASTRow StoremastRow;
 public string DoSave()
 {
     string retval="0";
     SqlTransaction tran = null;
     var isnew = false;
     try
     {
         var cn = new SqlConnection {ConnectionString = _constr};
         cn.Open();
         tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
         var dt = new DsMaster().STOREMAST;
         var ta = new DsMasterTableAdapters.STOREMASTTableAdapter();
         ta.Connection.ConnectionString = _constr;
         ta.Fill(dt);
         ta.AssignConnection(cn, tran);
         var dr = dt.FindBySTORECODE(storecode);
         if (dr != null)
         {
             dr.BeginEdit();
             dr.EditedBy = Utils.Userid;
         }
         else
         {
             dr = (DsMaster.STOREMASTRow) dt.NewRow();
             isnew = true;
             var autoid = new DataManager().GetAutoId(9);
             autoid++;
             storecode = String.Format("{0,-2:D2}", autoid);
             dr.CREATEDBY = Utils.Userid;
             dr.CREATEDATE = System.DateTime.Now.Date;
         }
         dr.STORECODE = storecode;
         dr.STORETYPE = storetype;
         dr.STORENAME = storename;
         dr.ADDRESSS = address;
         dr.PHONENO = phono;
         dr.FAXNO = fax;
         dr.COMM = communicationtype;
         dr.COMPANY = COMPANY;
         if (isnew)
         {
             dt.Rows.Add(dr);
             ta.Update(dt);
         }
         else
         {
             dr.EndEdit();
             ta.Update(dt);
         }
         new DataManager().UpdateAutoNum(9);
         tran.Commit();
         retval = "1";
     }
     catch (Exception ex)
     {
         retval = ex.ToString();
         if (tran != null) tran.Rollback();
     }
     return retval;
 }
예제 #2
0
 public DsMaster.TEMPBCODEPRINTDataTable CreateBarCodeTable(string purno)
 {
     var dt = new DsMaster().TEMPBCODEPRINT;
     var dm = new PurInvDataManager();
     Purinvdetail = dm.GetPurInvDetailsById(purno);
     foreach (DataRow dr in Purinvdetail.Rows)
     {
         var dnew = dt.NewRow();
         dnew["ITEMCODE"] = dr["itemno"];
         dnew["ITEMNAME"] = new BlItemMaster().GetItemname(dr["itemno"].ToString());
         var _qty = int.Parse(dr["qty"].ToString()) + (string.IsNullOrEmpty(dr["BONUSQTY"].ToString()) ? 0 : int.Parse(dr["BONUSQTY"].ToString()));
         dnew["QTY"] = _qty;
         dnew["PRICE"] = dr["SPRICE"];
         dt.Rows.Add(dnew);
     }
     return dt;
 }
예제 #3
0
 public string DoUpLoadSuppliers()
 {
     string retval = "1";
     var dtsupplier = new DataManager().GetSupplier();
     var ds = new DsMaster().SUPPLIER;
     var taSupplier = new DsMasterTableAdapters.SUPPLIERTableAdapter {Connection = {ConnectionString = _constr}};
     taSupplier.Fill(ds);
     foreach (DataRow dr in dtsupplier.Rows)
     {
         var isnew = false;
         var dsup = ds.FindBySUPPLIERNO(dr["SUPPLIERNO"].ToString());
         if (dsup != null)
         {
             dsup.BeginEdit();
         }
         else
         {
             dsup = (DsMaster.SUPPLIERRow)ds.NewRow();
             isnew = true;
             foreach (DataColumn dc in dtsupplier.Columns)
             {
                 dsup[dc.ColumnName] = dr[dc.ColumnName];
             }
         }
         bool update = true;
         if (!isnew)
         {
             update = Equals(dr, dsup);
         }
         if (!update)
         {
             foreach (DataColumn dc in dtsupplier.Columns)
             {
                 if (!dc.ReadOnly)
                     dsup[dc.ColumnName] = dr[dc.ColumnName];
             }
         }
         if (isnew)
         {
             ds.Rows.Add(dr.ItemArray);
             var t = taSupplier.Update(ds);
             if (t == 0)
                 retval += " Supplier master not created";
         }
         else
         {
             dsup.EndEdit();
             taSupplier.Update(dsup);
         }
     }
     return retval;
 }
예제 #4
0
 public string DoDownLoadCustomer()
 {
     string retval = "1";
     var _remotecustomer = new Customer().GetCustomerMembersDataTable(true, _syncConstr);
     var ds = new DsMaster().CUSTOMER;
     var taCustomer = new DsMasterTableAdapters.CUSTOMERTableAdapter{Connection = { ConnectionString = Utils.Connectionstring } };
     taCustomer.Fill(ds);
     foreach (DataRow dr in _remotecustomer.Rows)
     {
         var isnew = false;
         var dsup = ds.FindByCUSTNO(dr["CUSTNO"].ToString());
         if (dsup != null)
         {
             dsup.BeginEdit();
         }
         else
         {
             dsup = (DsMaster.CUSTOMERRow)ds.NewRow();
             isnew = true;
             foreach (DataColumn dc in _remotecustomer.Columns)
             {
                 if (dc.ColumnName == "CUSTOMERPOINT")
                 {
                     dsup[dc.ColumnName] = 0;
                 }
                 else
                 {
                     dsup[dc.ColumnName] = dr[dc.ColumnName];
                 }
             }
         }
         bool update = true;
         if (!isnew)
         {
             update = Equals(dr, dsup);
         }
         if (!update)
         {
             foreach (DataColumn dc in _remotecustomer.Columns)
             {
                 if (dc.ColumnName == "CUSTOMERPOINT")
                 {
                     dsup[dc.ColumnName] = 0;
                 }
                 else
                 {
                     dsup[dc.ColumnName] = dr[dc.ColumnName];
                 }
             }
         }
         if (isnew)
         {
             ds.Rows.Add(dsup);
             var t = taCustomer.Update(ds);
             if (t == 0)
                 retval += "Customer master not created";
         }
         else
         {
             dsup.EndEdit();
             taCustomer.Update(dsup);
         }
     }
     return retval;
 }
예제 #5
0
        public string DoUpLoadItems(string purid,bool ispurchase)
        {
            string retval = "1";
            var taItem = new DsMasterTableAdapters.ITEMMASTTableAdapter();
            var ds = new DsMaster().ITEMMAST;
            taItem.Connection.ConnectionString = _constr;
            
           // taItem.FillByBarCode()
            DataTable dtitems = null;
            dtitems = ispurchase ? new PurInvDataManager().GetItemMasterInPurchase(purid) : new PurInvDataManager().GetITEMsInTransfer(purid);
            string itemnos = dtitems.Rows.Cast<DataRow>().Aggregate("", (current, dr) => current + (dr["ITEMNO"].ToString() + ","));
           // taItem.FillByItemnos(ds, itemnos);
            bool isnew = false;
            foreach (DataRow dr in dtitems.Rows)
            {
                bool update = true;

                taItem.FillByITEMNO(ds, dr["ITEMNO"].ToString());
                var dsup = ds.FindByITEMNO(dr["ITEMNO"].ToString());
                if (dsup != null)
                {
                    isnew = false;
                    dsup.BeginEdit();
                    update = Equals(dr, dsup);
                }
                else
                {
                    dsup = (DsMaster.ITEMMASTRow)ds.NewRow();
                    isnew = true;
                }
                if (!update)
                {
                    foreach (DataColumn dc in dtitems.Columns)
                    {
                        if (!dc.ReadOnly)
                            dsup[dc.ColumnName] = dr[dc.ColumnName];
                    }
                }
                if (isnew)
                {
                    ds.Rows.Add(dr.ItemArray);
                    var t = taItem.Update(ds);
                    if (t == 0)
                        retval += "item mast not created";
                }
                else
                {
                    dsup.EndEdit();
                    taItem.Update(dsup);
                }
                isnew = false;
            }
            return retval;
        }
예제 #6
0
        public string DoSave()
        {
            string retval;
            SqlTransaction tran = null;
            var isnew = false;
            try
            {
                var cn = new SqlConnection {ConnectionString = _constr};
                cn.Open();
                tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
                var dt = new DsMaster().ITEMMAST;
                var ta = new DsMasterTableAdapters.ITEMMASTTableAdapter();
                ta.Connection.ConnectionString = _constr;
                ta.Fill(dt);
                ta.AssignConnection(cn, tran);
                var dr = dt.FindByITEMNO(Itemno);
                if (dr != null)
                {
                    dr.BeginEdit();
                    dr.editedby = Utils.Userid;
                    dr.editeddate = DateTime.Now.Date;
                }
                else
                {
                    dr = (DsMaster.ITEMMASTRow) dt.NewRow();
                    isnew = true;
                    var autoid = new DataManager().GetAutoId(12);
                    autoid++;
                    Utils.Itemno = Utils.Company + autoid.ToString("D5");
                    dr.ITEMNO = Utils.Itemno;
                    dr.CREATEDBY = Utils.Userid;
                    dr.CDATE = DateTime.Now.Date;
                    if (ItemmastRow.OWNBARCODE && string.IsNullOrEmpty(ItemmastRow.BARCODE))
                        dr.BARCODE = Utils.Itemno;
                    else
                    {
                        dr.BARCODE = ItemmastRow.BARCODE;
                    }
                }
                dr.ITEMTYPE = ItemmastRow.ITEMTYPE;
                dr.OWNBARCODE = ItemmastRow.OWNBARCODE;

                dr.ITEMNAME = ItemmastRow.ITEMNAME;
                dr.ARITEMNAME = ItemmastRow.ARITEMNAME;
                dr.BASEUOM = ItemmastRow.BASEUOM;
                dr.SUPPLIERNO = ItemmastRow.SUPPLIERNO;
                dr.MANFNAME = ItemmastRow.MANFNAME;
                dr.REORDER = ItemmastRow.REORDER;
                dr.UOM = ItemmastRow.UOM;
                dr.PRINTBARCODE = ItemmastRow.PRINTBARCODE;
                dr.EXPDATEREQ = ItemmastRow.EXPDATEREQ;
                dr.ACTIVE = ItemmastRow.ACTIVE;
                dr.CATEGORY = ItemmastRow.CATEGORY;
                dr.GROUPID = ItemmastRow.GROUPID;
                dr.GENERICID = ItemmastRow.GENERICID;
                dr.MARGIN = ItemmastRow.MARGIN;
                dr.MARKUP = ItemmastRow.MARKUP;
                dr.DISCOUNT = ItemmastRow.DISCOUNT;
                dr.FASTMOVING = ItemmastRow.FASTMOVING;
                dr.LOCATION = ItemmastRow.LOCATION;
                dr.TEMPRATURE = ItemmastRow.TEMPRATURE;
                dr.MINQTY = ItemmastRow.MINQTY;
                dr.MAXQTY = ItemmastRow.MAXQTY;
                dr.COMPANY = Utils.Company;
                dr.SEL = false;
                dr.DISCONSALE = ItemmastRow.DISCONSALE;
                dr.CPRICE = ItemmastRow.CPRICE;
                dr.SPRICE = ItemmastRow.SPRICE;
                dr.ITEMDEM = ItemmastRow.ITEMDEM;
                dr.COLOR=ItemmastRow.COLOR;
                dr.WEIGHT=ItemmastRow.WEIGHT;
                dr.POMINQTY =ItemmastRow.POMINQTY;
                dr.POMAXQTY =ItemmastRow.POMAXQTY;
                dr.DISCONSALE = ItemmastRow.DISCONSALE;
                dr.SALEDISCOUNTPER = ItemmastRow.SALEDISCOUNTPER;

                if (isnew)
                {
                    dt.Rows.Add(dr);
                    ta.Update(dt);
                }
                else
                {
                    dr.EndEdit();
                    ta.Update(dt);
                }
                new DataManager().UpdateAutoNum(12);
                tran.Commit();
                retval = "1";
            }
            catch (Exception ex)
            {
                retval = ex.ToString();
                if (tran != null) tran.Rollback();
            }
            return retval;
        }
예제 #7
0
        public string DoSave()
        {
            string retval=string.Empty;
            SqlTransaction tran = null;
            var isnew = false;
            try
            {
                var cn = new SqlConnection {ConnectionString = _constr};
                cn.Open();
                tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
                var dt = new DsMaster().CUSTOMER;
                var ta = new DsMasterTableAdapters.CUSTOMERTableAdapter {Connection = {ConnectionString = _constr}};

                ta.Fill(dt);

                ta.AssignConnection(cn, tran);

                var tains = new DsMasterTableAdapters.INSURANCEDISCTableAdapter
                                {Connection = {ConnectionString = _constr}};
                tains.AssignConnection(cn, tran);
                var dr = dt.FindByCUSTNO(customerRow.CUSTNO);

                if (dr != null)
                {
                    dr.BeginEdit();
                    Utils.CustomerNo = customerRow.CUSTNO;
                    dr.EUSERID = Utils.Userid;
                    dr.EDATE = DateTime.Now.Date;

                }
                else
                {
                    dr = (DsMaster.CUSTOMERRow) dt.NewRow();
                    isnew = true;
                    var autoid = new DataManager().GetAutoId(13);
                    autoid++;
                    Utils.CustomerNo = new DataManager().CreateFormatedAutoNo(autoid);
                    dr.CUSTNO = Utils.CustomerNo;
                    dr.CUSERID = Utils.Userid;
                    dr.CDATE = DateTime.Now.Date;
                }
                dr.CUSTOMERTYPE = customerRow.CUSTOMERTYPE;
                dr.CUSTOMERNAME = customerRow.CUSTOMERNAME;
                dr.CUSTCOMP = customerRow.CUSTCOMP;
                dr.CUSTOMERID = customerRow.CUSTOMERID;
                dr.PHONE = customerRow.PHONE;
                dr.Mobile = customerRow.Mobile;
                dr.EMAIL = customerRow.EMAIL;
                dr.NOTE = customerRow.NOTE;
                dr.FIXDISC = customerRow.FIXDISC;
                dr.FIXDISCAMTPER = customerRow.FIXDISCAMTPER;
                dr.CREDITLIMIT = customerRow.CREDITLIMIT;
                dr.COMPANY = Utils.Company;
                dr.PAYTYPE = customerRow.PAYTYPE;
                dr.MEMBERNO = customerRow.MEMBERNO;
                if (isnew)
                {
                    dt.Rows.Add(dr);
                    ta.Update(dt);
                }
                else
                {
                    dr.EndEdit();
                    ta.Update(dt);
                }

                if (insurancediscDataTable != null)
                {
                    foreach (DsMaster.INSURANCEDISCRow di in insurancediscDataTable.Rows)
                    {
                        di.CUSTNO = Utils.CustomerNo;
                    }
                    tains.Update(insurancediscDataTable);
                }
                tran.Commit();
                new DataManager().UpdateAutoNum(13);
                retval = "1";
            }
            catch (Exception ex)
            {
                retval = ex.ToString();
                if (tran != null) tran.Rollback();
            }
            return retval;
        }
예제 #8
0
 public string DoSave()
 {
     string retval;
     //  SqlTransaction tran = null;
     try
     {
         var cn = new SqlConnection {ConnectionString = _constr};
         cn.Open();
         //tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
         var dt = new DsMaster().USERINFO;
         bool isnew = false;
         var ta = new DsMasterTableAdapters.USERINFOTableAdapter() {Connection = cn};
         ta.Fill(dt);
         //ta.AssignConnection(cn, tran);
         var dr = dt.FindByUSERID(userinfoRow.USERID);
         if (dr != null)
         {
             dr.BeginEdit();
             dr.EDATE = System.DateTime.Now.Date;
             dr.EDITEDBY = Utils.Userid;
         }
         else
         {
             dr = (DsMaster.USERINFORow) dt.NewRow();
             isnew = true;
             dr.CREATEDBY = Utils.Userid;
             dr.CDATE = System.DateTime.Now.Date;
         }
         dr.USERNAME = userinfoRow.USERNAME;
         dr.FULLNAME = userinfoRow.FULLNAME;
         dr.EMPNO = userinfoRow.EMPNO;
         dr.PASSWORD = userinfoRow.PASSWORD;
         dr.ACTIVE = userinfoRow.ACTIVE;
         dr.PROFILEID = userinfoRow.PROFILEID;
         dr.USERTYPE = userinfoRow.USERTYPE;
         if (isnew)
         {
             dt.Rows.Add(dr);
             ta.Update(dt);
         }
         else
         {
             dr.EndEdit();
             ta.Update(dt);
         }
         //Utils.NewUserid
         retval = "1";
     }
     catch (Exception ex)
     {
         retval = ex.ToString();
         // if (tran != null) tran.Rollback();
     }
     return retval;
 }
예제 #9
0
        public string DoSaveInsuranceCustDatails(DsMaster.INSCUSTOMERSRow drow)
        {
            string retval = "0";
            //var cn = new SqlConnection(_constr);
            //SqlTransaction tran=null;
            try
            {

//                CUSTNO //FILENO,//CLASS //VISITNO //POLICYNO //PATNAME
               // cn.Open();
                var tam = new DsMasterTableAdapters.INSCUSTOMERSTableAdapter { Connection = { ConnectionString = _constr } };
                var dt = new DsMaster().INSCUSTOMERS;
                tam.Fill(dt);
                //tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
                //tam.AssignConnection(cn, tran);
                bool isnew = false;
                var dr = dt.FindByTID(drow.TID);
                if (dr != null)
                {
                    dr.BeginEdit();
                }else
                {
                    isnew = true;
                    dr = (DsMaster.INSCUSTOMERSRow)dt.NewRow(); //  CUSTNO //FILENO,//CLASS //VISITNO //POLICYNO //PATNAME
                    dr.FILENO = drow.FILENO;
                    dr.PATNAME = drow.PATNAME;
                    dr.POLICYNO = drow.POLICYNO;
                    dr.PATNAME = drow.PATNAME;
                    dr.CUSTNO = drow.CUSTNO;
                }
                if (isnew)
                {
                    dt.Rows.Add(dr);
                    tam.Update(dt);
                }
                else
                {
                    dr.EndEdit();
                    tam.Update(dt);
                }
              //  tran.Commit();
                retval = "1";
            }
            catch (Exception ex)
            {
                retval = ex.ToString();
                //if (tran != null && cn.State == ConnectionState.Open)
                //{
                //    tran.Rollback();
                //}
            }
            return retval;
        }
예제 #10
0
        public string DoSave(string scode,string sname,DsMaster.TERMSDETAILMASTDataTable Termsdetails)
        {
            string retval=string.Empty;
            SqlTransaction tran = null;
            var isnew = false;
            
            try
            {
                var cn = new SqlConnection { ConnectionString = _constr };
                cn.Open();
                tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);

                var dt = new DsMaster().TERMSMAST;
                var taMast = new DsMasterTableAdapters.TERMSMASTTableAdapter { Connection = { ConnectionString = _constr } };

                taMast.Fill(dt);

                taMast.AssignConnection(cn,tran);


                var taDetail = new DsMasterTableAdapters.TERMSDETAILMASTTableAdapter() ;
                taDetail.AssignConnection(cn,tran);

                var MastRow = dt.FindByTERMCODE(scode);
                if(MastRow!=null)
                {
                    MastRow.BeginEdit();
                }
                else
                {
                    MastRow = (DsMaster.TERMSMASTRow) dt.NewRow();
                    MastRow.TERMCODE = scode;
                    isnew = true;
                }
                MastRow.PAYNAME = sname;

                if (isnew)
                {
                    dt.Rows.Add(MastRow);
                    taMast.Update(dt);
                }
                else
                {
                    MastRow.EndEdit();
                    taMast.Update(dt);
                }
                taDetail.Update(Termsdetails);
                tran.Commit();
                retval = "1";
            }
            catch(Exception ex)
            {
                if (tran != null) tran.Rollback();
                retval = ex.ToString();
            }
            return retval;
        }
예제 #11
0
 public DsMaster.PRICEMASTERDataTable UpdatePriceMaster(DsPurchase.PURINVDETAILDataTable dt, string suplierid)
 {
     var ds = new DsMaster().PRICEMASTER;
     var dsf = new DsMaster().PRICEMASTER;
     var ta = new DsMasterTableAdapters.PRICEMASTERTableAdapter();
     foreach (DsPurchase.PURINVDETAILRow d in dt.Rows)
     {
         if (d.RowState != DataRowState.Deleted)
         {
             ta.Connection.ConnectionString = _constr;
             ta.FillBySupNo(dsf, d["ITEMNO"].ToString(), suplierid);
             if (dsf.Rows.Count > 0)
             {
                 foreach (DsMaster.PRICEMASTERRow drf in dsf.Rows)
                 {
                     if (!d.IsEXPDATENull())
                     {
                         if (drf.LASTEXPDT != d.EXPDATE)
                         {
                             drf.LASTEXPDT = d.EXPDATE;
                         }
                     }
                     if (drf.PPRICE != d.CPRICE || drf.SPRICE != d.SPRICE)
                     {
                         var dr = (DsMaster.PRICEMASTERRow) ds.NewRow();
                         dr.SUPPLIERNO = suplierid;
                         dr.PPRICE = d.CPRICE;
                         dr.SPRICE = d.SPRICE;
                         dr.PDATE = DateTime.Now.Date;
                         if (!d.IsEXPDATENull())
                         {
                             dr.LASTEXPDT = d.EXPDATE;
                         }
                         ds.Rows.Add(dr);
                     }
                 }
             }
             else
             {
                 var dr = (DsMaster.PRICEMASTERRow)ds.NewRow();
                 dr.SUPPLIERNO = suplierid;
                 dr.PPRICE = d.CPRICE;
                 dr.SPRICE = d.SPRICE;
                 dr.PDATE = DateTime.Now.Date;
                 if (!d.IsEXPDATENull())
                 {
                     dr.LASTEXPDT = d.EXPDATE;
                 }
                 ds.Rows.Add(dr);
             }
         }
     }
     return ds;
 }
예제 #12
0
 public string DoSave(string pname)
 {
     string retval;
     try
     {
         var cn = new SqlConnection {ConnectionString = _constr};
         cn.Open();
         var dt = new DsMaster().PROFILENAMEMAST;
         bool isnew = false;
         var ta = new DsMasterTableAdapters.PROFILENAMEMASTTableAdapter {Connection = cn};
         ta.Fill(dt);
         var dr = dt.FindByPROFILENAME(pname);
         if (dr != null)
         {
             dr.BeginEdit();
         }
         else
         {
             dr = (DsMaster.PROFILENAMEMASTRow) dt.NewRow();
             isnew = true;
         }
         dr.PROFILENAME = pname;
         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;
 }
예제 #13
0
 public string DoSave()
 {
     string retval = "0";
     SqlTransaction tran = null;
     var cn = new SqlConnection(_constr);
     try
     {
         bool isnew = false;
         cn.Open();
         var ta = new DsMasterTableAdapters.INSCUSTOMERSTableAdapter { Connection = { ConnectionString = _constr } };
         var dt = new DsMaster().INSCUSTOMERS;
         ta.Fill(dt);
         tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
         ta.AssignConnection(cn, tran);
         var dr = dt.FindByTID(InscustomersRow.TID);
         if (dr != null)
         {
             dr.BeginEdit();
         }
         else
         {
             isnew = true;
             dr = (DsMaster.INSCUSTOMERSRow)dt.NewRow();
             dr.FILENO = InscustomersRow.FILENO;
             dr.POLICYNO = InscustomersRow.POLICYNO;
             dr.CLASS = InscustomersRow.CLASS;
             dr.CUSTSHARE = InscustomersRow.CUSTSHARE;
             dr.PATNAME = InscustomersRow.PATNAME;
             dr.CUSTNO = InscustomersRow.CUSTNO;
         }
         if (isnew)
         {
             dt.Rows.Add(dr);
             ta.Update(dt);
         }
         else
         {
             dr.EndEdit();
             ta.Update(dt);
         }
         tran.Commit();
         retval = "1";
     }
     catch (Exception ex)
     {
         retval = ex.ToString();
         if (tran != null && cn.State == ConnectionState.Open)
         {
             tran.Rollback();
         }
     }
     return retval;
 }
예제 #14
0
 public string DoSave()
 {
     string retval;
     try
     {
         var cn = new SqlConnection {ConnectionString = _constr};
         cn.Open();
         var dt = new DsMaster().PROFILES;
         bool isnew = false;
         var ta = new DsMasterTableAdapters.PROFILESTableAdapter {Connection = cn};
         ta.Fill(dt);
         var dr = dt.FindByPROFILEID(ProfilenamesRow.PROFILEID);
         if (dr != null)
         {
             dr.BeginEdit();
             dr.EUSERID = Utils.Userid;
             dr.EDATE = DateTime.Now.Date;
         }
         else
         {
             dr = (DsMaster.PROFILESRow) dt.NewRow();
             isnew = true;
             dr.PROFILEID = ProfilenamesRow.PROFILEID;
             dr.CUSERID = Utils.Userid;
             dr.CDATE = DateTime.Now.Date;
         }
         dr.DETAILS = ProfilenamesRow.DETAILS;
         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;
 }
예제 #15
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;
 }
예제 #16
0
        public DataTable GetStoresDataBases()
        {
            var dt = new DsMaster().STOREDATABASES;
            var ds = GetAllDataBases();
            string[] connew = Utils.Connectionstring.Split(new[] { ';' });

            foreach (DataRow d in ds.Rows)
            {
                var dr = dt.NewRow();
                dr[0] = d[0];
              //  dr[1] = "Data Source=PHSERVER;Initial Catalog=" + d[0].ToString() + ";Persist Security Info=True;User ID=SA;Password=mutawa2011 ";
                dr[1] = connew[0] + ";" + "Initial Catalog =" + d[0].ToString() + ";" + connew[2] + ";" + connew[3] + ";" + connew[4] + ";";
                dt.Rows.Add(dr);
            }
            return dt;
        }
예제 #17
0
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            bool isvalid = false;
            if (txtfno.EditValue== null)
            {
                txtfno.ErrorText = "Enter File No";
                isvalid = true;
            }
            if (txtmemno.EditValue == null)
            {
                txtmemno.ErrorText = "Enter Member No";
                isvalid = true;
            }
            if (txtcompname.EditValue == null)
            {
                txtcompname.ErrorText = "Enter Company name";
                isvalid = true;
            }
            if (txtname.EditValue == null)
            {
                txtname.ErrorText = "Enter Patient name";
                isvalid = true;
            }
            if (!isvalid )
            {
                var bl = new BlInsuranceCustomer();
                var tb = new DsMaster().INSCUSTOMERS;
                var dr = (DsMaster.INSCUSTOMERSRow) tb.NewRow();
                dr.TID = Tid;
                dr.FILENO = txtfno.Text;
                dr.POLICYNO =int.Parse(txtmemno.EditValue.ToString());
                dr.CUSTNO = txtcompname.Text;
                dr.PATNAME = txtname.Text;
                bl.dr = dr;
                var msg = bl.DoSave();
                if (msg  == "1")
                {
                    if (
                        XtraMessageBox.Show("Saved do you want to add more", "Patient Details", MessageBoxButtons.YesNo) ==
                        DialogResult.Yes)
                    {
                        Tid = 0;
                        txtfno.Text = string.Empty;
                        txtfno.Text = string.Empty;
                        txtmemno.Text = string.Empty;
                        txtcompname.Text = string.Empty;
                        txtname.Text = string.Empty;
                    }
                    else
                    {
                        Custno = txtname.Text;
                        Custpayment = cutomerpayment.EditValue.ToString();
                        Close();
                    }
                }
                else
                {
                    XtraMessageBox.Show(msg, "Patient Details", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

            }
        }
예제 #18
0
 public string DoSaveDrugDispatch(DsMaster.DDMASTRow drow,DsMaster.DDDETAILSDataTable dtTable)
 {
     string retval = string.Empty;
     SqlTransaction tran = null;
     var cn = new SqlConnection(_constr);
     try
     {
         cn.Open();
         var tadet = new  DsMasterTableAdapters.DDDETAILSTableAdapter() ;
         var tam = new DsMasterTableAdapters.DDMASTTableAdapter {Connection = {ConnectionString = _constr}};
         var dt = new DsMaster().DDMAST;
         tam.Fill(dt);
         tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
         tam.AssignConnection(cn, tran);
         tadet.AssignConnection(cn, tran);
         bool isnew = false;
         var dr = dt.FindByDNO(drow.DNO);
         if (dr != null)
         {
             dr.BeginEdit();
             Utils.DosageNo = drow.DNO;
         }
         else
         {
             isnew = true;
             var autoid = new DataManager().GetAutoId(19);
             autoid++;
             Utils.DosageNo = new DataManager().CreateFormatedAutoNo(autoid);
             dr = (DsMaster.DDMASTRow) dt.NewRow();
             dr.DNO = Utils.DosageNo;
             dr.PATNAME = drow.PATNAME;
             dr.HOSPITAL = drow.HOSPITAL;
             dr.DOCTOR = drow.DOCTOR;
             dr.TDATE = drow.TDATE;
             dr.COMP = drow.COMP;
         }
         foreach (DsMaster.DDDETAILSRow crow in dtTable.Rows)
         {
             crow.DNO = Utils.DosageNo;
         }
         if (isnew)
         {
             dt.Rows.Add(dr);
             tam.Update(dt);
         }
         else
         {
             dr.EndEdit();
             tam.Update(dt);
         }
         tadet.Update( dtTable);
         new DataManager().UpdateAutoNum(19);
         tran.Commit();
         retval = "1";
     }
     catch (Exception ex)
     {
         retval = ex.ToString();
         if (tran != null && cn.State == ConnectionState.Open)
         {
             tran.Rollback();
         }
     }
     return retval;
 }
예제 #19
0
        public DsMaster.TEMPBCODEPRINTDataTable CreateBarCode(string  tranid )
        {
            var dt = new DsMaster().TEMPBCODEPRINT;
            Itemtransferdetail = GetItemTranferDetails(tranid);
            foreach (DataRow dr in Itemtransferdetail.Rows)
            {
                var dnew = dt.NewRow();
                dnew["ITEMCODE"] = dr["itemno"];
                dnew["ITEMNAME"] = new BlItemMaster().GetItemname(dr["itemno"].ToString());
                dnew["QTY"] = dr["qty"];
                dnew["PRICE"] = dr["SPRICE"];
                dt.Rows.Add(dnew);
            }
             

            return dt;
        }
예제 #20
0
        public string DoSave(DsMaster.PRINTERSRow printersRow)
        {
            try
            {
                var dt = new DsMaster().PRINTERS;
                var ta = new DsMasterTableAdapters.PRINTERSTableAdapter() {Connection = {ConnectionString = _constr}};
                bool isnew = false;
                ta.Fill(dt);
                var drnew = dt.FindByTID(printersRow.TID);
                if (drnew != null)
                {
                    drnew.BeginEdit();
                }
                else
                {
                    drnew = (DsMaster.PRINTERSRow) dt.NewRow();
                    isnew = true;
                }
                drnew.BarcodePrinter = printersRow.BarcodePrinter;
                drnew.Invoiceprinter = printersRow.Invoiceprinter;
                drnew.Drugprinter = printersRow.Drugprinter;
                drnew.Computer = printersRow.Computer;
                drnew.Defaultprinter = printersRow.Defaultprinter;
                drnew.ISDEFAULT = printersRow.ISDEFAULT;
                if (isnew)
                {
                    dt.Rows.Add(drnew);
                    ta.Update(dt);
                }
                else
                {
                    drnew.EndEdit();

                    ta.Update(drnew);
                }
                return "1";
            }
            catch (Exception ex)
            {
                return ex.ToString();
            }
        }