示例#1
0
 public DsMaster.INSCUSTOMERSRow GetInscustomersRowByFileNo(string fileno)
 {
     var tam = new DsMasterTableAdapters.INSCUSTOMERSTableAdapter { Connection = { ConnectionString = _constr } };
     var dt = new DsMaster().INSCUSTOMERS;
     tam.FillByFILENO(dt,fileno);
     DsMaster.INSCUSTOMERSRow dr = null;
     if (dt.Rows.Count > 0)
         dr = dt[0];
     return dr;
 }
示例#2
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;
        }
示例#3
0
 public DsMaster.INSCUSTOMERSRow GetInscustomersRowByPolicyNo(string policyno)
 {
     var tam = new DsMasterTableAdapters.INSCUSTOMERSTableAdapter { Connection = { ConnectionString = _constr } };
     var dt = new DsMaster().INSCUSTOMERS;
     tam.FillByPOLICYNO(dt,int.Parse(policyno));
     DsMaster.INSCUSTOMERSRow dr=null;
     if (dt.Rows.Count > 0)
         dr = dt[0];
     return  dr;
 }
示例#4
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;
 }