public static int Insert(driverdetails dt)
        {
            string query = "INSERT INTO driverdetails VALUES(@driverid, @drivername,@age, @mobileno, @address,@licanceno,@vehicleno,@residenceno,@familyno,@relation,@bgroup,@bankname,@branchname,@acno,@ifsccode,@isactive)";
            List <SqlParameter> parameters = new List <SqlParameter>();

            //   parameters.Add(new SqlParameter("@Cid", dt.id));

            parameters.Add(new SqlParameter("@driverid", dt.driverid));
            parameters.Add(new SqlParameter("@drivername", dt.drivername));
            parameters.Add(new SqlParameter("@age", dt.age));
            parameters.Add(new SqlParameter("@mobileno", dt.mobileno));
            parameters.Add(new SqlParameter("@address", dt.address));
            parameters.Add(new SqlParameter("@licanceno", dt.licanceno));
            parameters.Add(new SqlParameter("@vehicleno", dt.vehicleno));
            parameters.Add(new SqlParameter("@residenceno", dt.residenceno));
            parameters.Add(new SqlParameter("@familyno", dt.familyno));
            parameters.Add(new SqlParameter("@relation", dt.relation));
            parameters.Add(new SqlParameter("@bgroup", dt.bgroup));
            parameters.Add(new SqlParameter("@bankname", dt.bankname));
            parameters.Add(new SqlParameter("@branchname", dt.branchname));
            parameters.Add(new SqlParameter("@acno", dt.acno));
            parameters.Add(new SqlParameter("@ifsccode", dt.ifsccode));
            parameters.Add(new SqlParameter("@isactive", dt.isactive));

            return(DBHelper.ModifyData(query, parameters));
        }
        public static int Update(driverdetails dt)
        {
            string query = "UPDATE driverdetails SET drivername = @drivername,age = @age,mobileno = @mobileno,address = @address,licanceno = @licanceno,vehicleno = @vehicleno,residenceno = @residenceno,familyno = @familyno,relation = @relation,bgroup = @bgroup,bankname = @bankname,acno = @acno,ifsccode = @ifsccode,isactive = @isactive  WHERE id = @ID";
            List <SqlParameter> parameters = new List <SqlParameter>();

            //  parameters.Add(new SqlParameter("@driverid", dt.driverid));
            parameters.Add(new SqlParameter("@id", dt.id));
            parameters.Add(new SqlParameter("@drivername", dt.drivername));
            parameters.Add(new SqlParameter("@age", dt.age));
            parameters.Add(new SqlParameter("@mobileno", dt.mobileno));
            parameters.Add(new SqlParameter("@address", dt.address));
            parameters.Add(new SqlParameter("@licanceno", dt.licanceno));
            parameters.Add(new SqlParameter("@vehicleno", dt.vehicleno));
            parameters.Add(new SqlParameter("@residenceno", dt.residenceno));
            parameters.Add(new SqlParameter("@familyno", dt.familyno));
            parameters.Add(new SqlParameter("@relation", dt.relation));
            parameters.Add(new SqlParameter("@bgroup", dt.bgroup));
            parameters.Add(new SqlParameter("@bankname", dt.bankname));
            parameters.Add(new SqlParameter("@branchname", dt.branchname));
            parameters.Add(new SqlParameter("@acno", dt.acno));
            parameters.Add(new SqlParameter("@ifsccode", dt.ifsccode));
            parameters.Add(new SqlParameter("@isactive", dt.isactive));

            return(DBHelper.ModifyData(query, parameters));
        }
Ejemplo n.º 3
0
        public ActionResult DriverEditSubmit()
        {
            int           id = Convert.ToInt32(Request.Params["id"]);
            driverdetails dd = DriverLogic.SelectByPK(id);

            //dd.driverid = (Guid) Request.Params["driverid"];
            dd.id          = Convert.ToInt32(Request.Params["id"]);
            dd.drivername  = Convert.ToString(Request.Params["drivername"]);
            dd.age         = Convert.ToString(Request.Params["age"]);
            dd.mobileno    = Convert.ToString(Request.Params["mobileno"]);
            dd.address     = Convert.ToString(Request.Params["address"]);
            dd.licanceno   = Convert.ToString(Request.Params["licanceno"]);
            dd.vehicleno   = Convert.ToString(Request.Params["vehicleno"]);
            dd.residenceno = Convert.ToString(Request.Params["residenceno"]);
            dd.familyno    = Convert.ToString(Request.Params["familyno"]);
            dd.relation    = Convert.ToString(Request.Params["relation"]);
            dd.bgroup      = Convert.ToString(Request.Params["bgroup"]);
            dd.bankname    = Convert.ToString(Request.Params["bankname"]);
            dd.branchname  = Convert.ToString(Request.Params["branchname"]);
            dd.acno        = Convert.ToString(Request.Params["acno"]);
            dd.ifsccode    = Convert.ToString(Request.Params["ifsccode"]);
            dd.isactive    = (Request.Params["isactive"] == "1");

            DriverLogic.Update(dd);

            return(RedirectToAction("fetch"));
        }
        public static int Delete(driverdetails c)
        {
            string query = "UPDATE Category SET isactive = @isactive WHERE id = @id";
            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@isactive", c.isactive));
            parameters.Add(new SqlParameter("@id", c.id));

            return(DBHelper.ModifyData(query, parameters));
        }
        public static driverdetails SelectByPK(int ID)
        {
            string query = "SELECT * FROM driverdetails WHERE id = @id";
            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@id", ID));
            DataTable     dt = DBHelper.SelectData(query, parameters);
            driverdetails d  = new driverdetails();

            if (dt.Rows.Count == 0)
            {
                return(d);
            }
            else
            {
                d.id          = ID;
                d.driverid    = (Guid)dt.Rows[0]["driverid"];
                d.drivername  = dt.Rows[0]["drivername"].ToString();
                d.age         = dt.Rows[0]["age"].ToString();
                d.mobileno    = dt.Rows[0]["mobileno"].ToString();
                d.address     = dt.Rows[0]["address"].ToString();
                d.licanceno   = dt.Rows[0]["licanceno"].ToString();
                d.vehicleno   = dt.Rows[0]["vehicleno"].ToString();
                d.residenceno = dt.Rows[0]["residenceno"].ToString();
                d.familyno    = dt.Rows[0]["familyno"].ToString();
                d.relation    = dt.Rows[0]["relation"].ToString();
                d.bgroup      = dt.Rows[0]["bgroup"].ToString();
                d.bankname    = dt.Rows[0]["bankname"].ToString();
                d.branchname  = dt.Rows[0]["branchname"].ToString();
                d.acno        = dt.Rows[0]["acno"].ToString();
                d.ifsccode    = dt.Rows[0]["ifsccode"].ToString();
                d.isactive    = (bool)dt.Rows[0]["isactive"];


                return(d);
            }
        }
Ejemplo n.º 6
0
        public DataTable Driver(driverdetails d)
        {
            DataTable      dt          = new DataTable();
            LogTraceWriter traceWriter = new LogTraceWriter();
            SqlConnection  conn        = new SqlConnection();

            try
            {
                traceWriter.Trace(Request, "0", TraceLevel.Info, "{0}", "Driver....");
                StringBuilder str = new StringBuilder();
                str.Append("@CompanyId" + d.Company + ",");
                str.Append("@NAme" + d.Name + ",");
                str.Append("@PAddress" + d.PermanentAddress + ",");
                str.Append("@PMobNo" + d.Mobilenumber + ",");
                str.Append("@DriverCode" + d.drivercode + ",");

                traceWriter.Trace(Request, "0", TraceLevel.Info, "{0}", "Driver Input sent...." + str.ToString());
                conn.ConnectionString = ConfigurationManager.ConnectionStrings["btposdb"].ToString();
                SqlCommand cmd = new SqlCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "HVInsUpddriver";
                cmd.Connection  = conn;


                SqlParameter ff = new SqlParameter("@flag", SqlDbType.VarChar);
                ff.Value = d.flag;
                cmd.Parameters.Add(ff);

                SqlParameter i = new SqlParameter("@DId", SqlDbType.Int);
                i.Value = d.DId;
                cmd.Parameters.Add(i);

                SqlParameter di = new SqlParameter("@CompanyId", SqlDbType.VarChar, 50);
                di.Value = d.Company;
                cmd.Parameters.Add(di);

                SqlParameter n = new SqlParameter("@NAme", SqlDbType.VarChar, 50);
                n.Value = d.Name;
                cmd.Parameters.Add(n);

                SqlParameter r = new SqlParameter("@Address", SqlDbType.VarChar, 50);
                r.Value = d.Address;
                cmd.Parameters.Add(r);

                SqlParameter f = new SqlParameter("@PAddress", SqlDbType.VarChar, 50);
                f.Value = d.PermanentAddress;
                cmd.Parameters.Add(f);

                SqlParameter s = new SqlParameter("@Pin", SqlDbType.VarChar, 50);
                s.Value = d.Pin;
                cmd.Parameters.Add(s);

                SqlParameter g = new SqlParameter("@PPin", SqlDbType.VarChar, 50);
                g.Value = d.PermanentPin;
                cmd.Parameters.Add(g);

                SqlParameter j = new SqlParameter("@PMobNo", SqlDbType.VarChar, 255);
                j.Value = d.Mobilenumber;
                cmd.Parameters.Add(j);

                SqlParameter fr = new SqlParameter("@FirstName", SqlDbType.VarChar, 50);
                fr.Value = d.FirstName;
                cmd.Parameters.Add(fr);

                SqlParameter lk = new SqlParameter("@LastName", SqlDbType.VarChar, 50);
                lk.Value = d.LastName;
                cmd.Parameters.Add(lk);


                SqlParameter ed = new SqlParameter("@EmailId", SqlDbType.VarChar, 50);
                ed.Value = d.EmailId;
                cmd.Parameters.Add(ed);

                SqlParameter dc = new SqlParameter("@DriverCode", SqlDbType.VarChar);
                dc.Value = d.drivercode;
                cmd.Parameters.Add(dc);

                SqlParameter pr = new SqlParameter("@Photo", SqlDbType.VarChar, -1);
                pr.Value = d.Photo;
                cmd.Parameters.Add(pr);

                SqlParameter cs = new SqlParameter("@CurrentStateId", SqlDbType.Int);
                cs.Value = d.CurrentStateId;
                cmd.Parameters.Add(cs);

                SqlParameter ctry = new SqlParameter("@Country", SqlDbType.VarChar, 50);
                ctry.Value = d.CountryId;
                cmd.Parameters.Add(ctry);

                SqlParameter vg = new SqlParameter("@VehicleGroupId", SqlDbType.VarChar, 50);
                vg.Value = d.VehicleGroup;
                cmd.Parameters.Add(vg);

                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(dt);

                traceWriter.Trace(Request, "0", TraceLevel.Info, "{0}", "Driver successful....");
            }
            catch (Exception ex)
            {
                traceWriter.Trace(Request, "0", TraceLevel.Error, "{0}", "Driver...." + ex.Message.ToString());
                //throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message));
                dt.Columns.Add("Code");
                dt.Columns.Add("description");
                DataRow dr = dt.NewRow();
                dr[0] = "ERR001";
                dr[1] = ex.Message;
                dt.Rows.Add(dr);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
                SqlConnection.ClearPool(conn);
            }
            return(dt);
        }
        public DataTable Driverlist(driverdetails d)
        {
            SqlConnection conn = new SqlConnection();
            try { 
            conn.ConnectionString = ConfigurationManager.ConnectionStrings["btposdb"].ToString();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "HVInsUpddrivers";
            cmd.Connection = conn;

            SqlParameter ff = new SqlParameter("@flag", SqlDbType.VarChar);
            ff.Value = d.flag;
            cmd.Parameters.Add(ff);

            SqlParameter i = new SqlParameter("@DId", SqlDbType.Int);
            i.Value = d.DId;
            cmd.Parameters.Add(i);

            SqlParameter di = new SqlParameter("@CountryId", SqlDbType.VarChar, 50);
            di.Value = d.Country;
            cmd.Parameters.Add(di);

            SqlParameter n = new SqlParameter("@NAme", SqlDbType.VarChar, 50);
            n.Value = d.Name;
            cmd.Parameters.Add(n);

            SqlParameter r = new SqlParameter("@Address", SqlDbType.VarChar, 50);
            r.Value = d.Address;
            cmd.Parameters.Add(r);

            SqlParameter f = new SqlParameter("@PAddress", SqlDbType.VarChar, 50);
            f.Value = d.PermanentAddress;
            cmd.Parameters.Add(f);

            SqlParameter s = new SqlParameter("@Pin", SqlDbType.VarChar, 50);
            s.Value = d.Pin;
            cmd.Parameters.Add(s);

            SqlParameter g = new SqlParameter("@PPin", SqlDbType.VarChar, 50);
            g.Value = d.PermanentPin;
            cmd.Parameters.Add(g);

            SqlParameter j = new SqlParameter("@PMobNo", SqlDbType.VarChar, 255);
            j.Value = d.Mobilenumber;
            cmd.Parameters.Add(j);

            SqlParameter fr = new SqlParameter("@FirstName", SqlDbType.VarChar, 50);
            fr.Value = d.FirstName;
            cmd.Parameters.Add(fr);

            SqlParameter lk = new SqlParameter("@LastName", SqlDbType.VarChar, 50);
            lk.Value = d.LastName;
            cmd.Parameters.Add(lk);


            SqlParameter ed = new SqlParameter("@EmailId", SqlDbType.VarChar, 50);
            ed.Value = d.EmailId;
            cmd.Parameters.Add(ed);

            SqlParameter dc = new SqlParameter("@DriverCode", SqlDbType.VarChar);
            dc.Value = d.drivercode;
            cmd.Parameters.Add(dc);

            SqlParameter pr = new SqlParameter("@Photo", SqlDbType.VarChar);
            pr.Value = d.Photo;
            cmd.Parameters.Add(pr);

            SqlParameter bg = new SqlParameter("@BloodGroup", SqlDbType.VarChar);
            bg.Value = d.BloodGroup;
            cmd.Parameters.Add(bg);

            SqlParameter df = new SqlParameter("@DOB", SqlDbType.DateTime);
            df.Value = d.DOB;
            cmd.Parameters.Add(df);

            SqlParameter dfs = new SqlParameter("@DOJ", SqlDbType.DateTime);
            dfs.Value = d.DOJ;

            cmd.Parameters.Add(dfs);

            SqlParameter sd = new SqlParameter("@Status", SqlDbType.Int);
            sd.Value = d.Status;
            cmd.Parameters.Add(sd);

            SqlParameter vf = new SqlParameter("@VehicleGroupId", SqlDbType.Int);
            vf.Value = d.VehicleGroup;
            cmd.Parameters.Add(vf);

            SqlParameter gf = new SqlParameter("@IsVerified", SqlDbType.Int);
            gf.Value = d.IsVerified;
            cmd.Parameters.Add(gf);

            SqlParameter hd = new SqlParameter("@IsApproved", SqlDbType.Int);
            hd.Value = d.IsApproved;
            cmd.Parameters.Add(hd);

            SqlParameter cdd = new SqlParameter("@CurrentStateId", SqlDbType.Int);
            cdd.Value = d.CurrentStateId;
            cmd.Parameters.Add(cdd);

            SqlParameter ptt = new SqlParameter("@PaymentTypeId", SqlDbType.Int);
            ptt.Value = d.PaymentTypeId;
            cmd.Parameters.Add(ptt);


                DataTable dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(dt);

            return dt;
            }
            catch (Exception ex)
            {
                if (conn != null && conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                throw ex;
            }
        }
Ejemplo n.º 8
0
        public ActionResult DriverEdit()
        {
            driverdetails dtls = DriverLogic.SelectByPK(Convert.ToInt32(Request.Params["id"]));

            return(View(dtls));
        }