Example #1
0
        private void LoadData()
        {
            int returnValue;
            SqlCommand cmd;

            SqlParameter[] parameters =
            {
                new SqlParameter("@OrgId",SqlDbType.Int,4,ParameterDirection.Input,false,0,0,null,DataRowVersion.Default,OrgId),
                new SqlParameter("@Id",SqlDbType.Int,4,ParameterDirection.Input,false,0,0,null,DataRowVersion.Default,EquipId),
                new SqlParameter("@vchEquipId",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@intYear",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchType",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchMake",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchModel",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchAssignedTo",SqlDbType.VarChar,100,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null)
            };
            DbObject dbobj = new DbObject();
            cmd = dbobj.cmdRunProcedure("sp_SelectEquipView",parameters,out returnValue);
            if(returnValue!=-1)
            {
                lbEquipId.Text=cmd.Parameters["@vchEquipId"].Value.ToString();
                lbTypeMakeModel.Text=cmd.Parameters["@vchType"].Value.ToString()+"/"+cmd.Parameters["@vchMake"].Value.ToString()+"/"+cmd.Parameters["@vchModel"].Value.ToString();
                lbYear.Text=cmd.Parameters["@intYear"].Value.ToString();
                lbAssignFrom.Text=cmd.Parameters["@vchAssignedTo"].Value.ToString();
            }
            SqlParameter[] parameters2 =
            {
                new SqlParameter("@OrgId",SqlDbType.Int,4,ParameterDirection.Input,false,0,0,null,DataRowVersion.Default,OrgId),
                new SqlParameter("@EquipId",SqlDbType.Int,4,ParameterDirection.Input,false,0,0,null,DataRowVersion.Default,EquipId)
            };
            DataSet dsobj=dbobj.dsRunProcedure("sp_SelectEquipAssignTo",parameters2,"Names");

            ddAssignTo.DataSource = dsobj;
            ddAssignTo.DataMember = "Names";
            ddAssignTo.DataValueField = "id";
            ddAssignTo.DataTextField = "vchName";
            ddAssignTo.DataBind();
            ddAssignTo.Items.Insert(0,new System.Web.UI.WebControls.ListItem("","0"));
        }
Example #2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            EquipId=Convert.ToInt32(Request.QueryString["id"]);

            if(EquipId==0){ //Add New
                string [,] arrBrdCrumbs = new string [2,2];
                arrBrdCrumbs[0,0]="../default.aspx";
                arrBrdCrumbs[0,1]="Home";
                arrBrdCrumbs[1,0]="list.aspx";
                arrBrdCrumbs[1,1]="Equipment List";
                PageTitle = "Add Equipment";
                Header.BrdCrumbs=ParseBreadCrumbs(arrBrdCrumbs,PageTitle);
                Header.PageTitle=PageTitle;

                ckReassign.Visible=false;
                lbAssignedToCap.Visible=false;
                lbReassignCap.Visible=false;
                lbReassignHelp.Visible=false;

            }else{
                string [,] arrBrdCrumbs = new string [3,2];
                arrBrdCrumbs[0,0]="../default.aspx";
                arrBrdCrumbs[0,1]="Home";
                arrBrdCrumbs[1,0]="list.aspx";
                arrBrdCrumbs[1,1]="Equipment List";
                arrBrdCrumbs[2,0]="view.aspx?id="+EquipId+"";
                arrBrdCrumbs[2,1]="Equipment Detail";
                PageTitle = "Equipment-Edit Main";
                Header.BrdCrumbs=ParseBreadCrumbs(arrBrdCrumbs,PageTitle);
                Header.PageTitle=PageTitle;
            }
            SaveCancelControl.ParentPageURL=ParentPageURL;
            #region Not Postback
            if(!Page.IsPostBack)//Not Postback
            {
                DbObject dbobj1 = new DbObject();
                if(EquipId!=0) //Look up existing values
                {
                    //Lookup current DB values

                    SqlParameter[] parameters =
                    {
                        new SqlParameter("@Action",SqlDbType.Char,1,ParameterDirection.Input,false,0,0,null,DataRowVersion.Default,"S"),
                        new SqlParameter("@OrgId",SqlDbType.Int,4,ParameterDirection.Input,false,0,0,null,DataRowVersion.Default,OrgId),
                        new SqlParameter("@Id",SqlDbType.Int,4,ParameterDirection.Input,false,0,0,null,DataRowVersion.Default,EquipId),
                        new SqlParameter("@TypeId",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                        new SqlParameter("@MakeId",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                        new SqlParameter("@ModelId",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                        new SqlParameter("@vchEquipId",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                        new SqlParameter("@intYear",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                        new SqlParameter("@DeptId",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                        new SqlParameter("@LocId",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                        new SqlParameter("@vchAssignedTo",SqlDbType.VarChar,100,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                        new SqlParameter("@vchVinSerial",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                        new SqlParameter("@vchFuelCode",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null)
                    };
                    int returnValue;
                    //SqlCommand cmd = dbobj1.cmdRunProcedure("sp_SelectEquipDetail",parameters,out returnValue);
                    SqlCommand cmd = dbobj1.cmdRunProcedure("sp_EquipEditDetail",parameters,out returnValue);

                    if(returnValue!=-1)
                    {
                        ddTypeId.SelectedValue=cmd.Parameters["@TypeId"].Value.ToString();
                        ddMakeId.SelectedValue=cmd.Parameters["@MakeId"].Value.ToString();
                        ddModelId.SelectedValue=cmd.Parameters["@ModelId"].Value.ToString();
                        tbEquipId.Text=cmd.Parameters["@vchEquipId"].Value.ToString();
                        tbYear.Text=cmd.Parameters["@intYear"].Value.ToString();
                        ddDeptId.SelectedValue=cmd.Parameters["@DeptId"].Value.ToString();
                        ddLocationId.SelectedValue=cmd.Parameters["@LocId"].Value.ToString();
                        lbAssignedTo.Text=cmd.Parameters["@vchAssignedTo"].Value.ToString();
                        tbVinSerial.Text=cmd.Parameters["@vchVinSerial"].Value.ToString();
                        tbFuelCode.Text=cmd.Parameters["@vchFuelCode"].Value.ToString();
                    }
                    else //record not found
                    {
                        Response.Redirect("list.aspx");
                    }
                } //End looking up current values
                BindData(dbobj1);
            }//End Not Postback
            #endregion
        }
Example #3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            EquipId=Convert.ToInt32(Request.QueryString["id"]);

            PageTitle = "Equipment Detail";
            string [,] arrBrdCrumbs = new string [2,2];
            arrBrdCrumbs[0,0]="../default.aspx";
            arrBrdCrumbs[0,1]="Home";
            arrBrdCrumbs[1,0]="list.aspx";
            arrBrdCrumbs[1,1]="Equipment List";
            Header.BrdCrumbs=ParseBreadCrumbs(arrBrdCrumbs,PageTitle);
            Header.PageTitle=PageTitle;

            DbObject dbobj1 = new DbObject();

            SqlParameter[] parameters =
            {
                new SqlParameter("@OrgId",SqlDbType.Int,4,ParameterDirection.Input,false,0,0,null,DataRowVersion.Default,OrgId),
                new SqlParameter("@Id",SqlDbType.Int,4,ParameterDirection.Input,false,0,0,null,DataRowVersion.Default,EquipId),
                new SqlParameter("@vchEquipId",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@intYear",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchType",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchMake",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchModel",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchDept",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchLocation",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchAssignedTo",SqlDbType.VarChar,100,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchVinSerial",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchStatus",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchPMSched",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchInspect",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@intCurrentUnits",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@dtInService",SqlDbType.SmallDateTime,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@dtAquired",SqlDbType.SmallDateTime,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchPurOrgContact",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@smPurAmount",SqlDbType.SmallMoney,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@intPurUnits",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchPurNotes",SqlDbType.VarChar,250,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@dtOutOfService",SqlDbType.SmallDateTime,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@dtDisposed",SqlDbType.SmallDateTime,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchDispOrgContact",SqlDbType.VarChar,50,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@smDispAmount",SqlDbType.SmallMoney,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@intDispUnits",SqlDbType.Int,4,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchDispNotes",SqlDbType.VarChar,250,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchDispMethod",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),

                new SqlParameter("@vchTransMake",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchTransModel",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchTransPart",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchTransSerial",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),

                new SqlParameter("@vchEngineMake",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchEngineModel",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchEnginePart",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchEngineSerial",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),

                new SqlParameter("@vchChasisMake",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),
                new SqlParameter("@vchChasisNumber",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null),

                new SqlParameter("@vchFuelCode",SqlDbType.VarChar,25,ParameterDirection.Output,false,0,0,null,DataRowVersion.Default,null)
            };
            int returnValue;
            SqlCommand cmd = dbobj1.cmdRunProcedure("sp_SelectEquipView",parameters,out returnValue);

            lbYear.Text=cmd.Parameters["@intYear"].Value.ToString();
            lbDept.Text=cmd.Parameters["@vchDept"].Value.ToString();
            lbLoc.Text=cmd.Parameters["@vchLocation"].Value.ToString();
            lbVinSerial.Text=cmd.Parameters["@vchVinSerial"].Value.ToString();
            lbAssignedTo.Text=cmd.Parameters["@vchAssignedTo"].Value.ToString();

            lbStrEquipId.Text=cmd.Parameters["@vchEquipId"].Value.ToString();
            lbMake.Text=cmd.Parameters["@vchMake"].Value.ToString();
            lbModel.Text=cmd.Parameters["@vchModel"].Value.ToString();;
            lbType.Text=cmd.Parameters["@vchType"].Value.ToString();

            lbStatus.Text=cmd.Parameters["@vchStatus"].Value.ToString();
            lbPMSched.Text=cmd.Parameters["@vchPMSched"].Value.ToString();
            lbInspection.Text=cmd.Parameters["@vchInspect"].Value.ToString();
            lbUnits.Text=cmd.Parameters["@intCurrentUnits"].Value.ToString();

            lbDtInService.Text=String.Format("{0:d}",cmd.Parameters["@dtInService"].Value);
            lbDtAquired.Text=String.Format("{0:d}",cmd.Parameters["@dtAquired"].Value);
            lbVchPurOrgContact.Text=cmd.Parameters["@vchPurOrgContact"].Value.ToString();
            lbSmPurAmount.Text=String.Format("{0:0.00}",cmd.Parameters["@smPurAmount"].Value);
            lbIntPurUnits.Text=cmd.Parameters["@intPurUnits"].Value.ToString();
            lbVchPurNotes.Text=cmd.Parameters["@vchPurNotes"].Value.ToString();

            lbDtOutOfService.Text=String.Format("{0:d}",cmd.Parameters["@dtOutOfService"].Value);;
            lbDtDisposed.Text=String.Format("{0:d}",cmd.Parameters["@dtDisposed"].Value);;
            lbVchDispOrgContact.Text=cmd.Parameters["@vchDispOrgContact"].Value.ToString();;
            lbSmDispAmount.Text=String.Format("{0:0.00}",cmd.Parameters["@smDispAmount"].Value);;
            lbIntDispUnits.Text=cmd.Parameters["@intDispUnits"].Value.ToString();;
            lbVchDispNotes.Text=cmd.Parameters["@vchDispNotes"].Value.ToString();
            lbVchDispMethod.Text=cmd.Parameters["@vchDispMethod"].Value.ToString();

            lbTranMake.Text=cmd.Parameters["@vchTransMake"].Value.ToString();
            tbTransModel.Text=cmd.Parameters["@vchTransModel"].Value.ToString();
            lbTranPart.Text=cmd.Parameters["@vchTransPart"].Value.ToString();
            lbTranSerial.Text=cmd.Parameters["@vchTransSerial"].Value.ToString();

            lbEngineMake.Text=cmd.Parameters["@vchEngineMake"].Value.ToString();
            lbEngineModel.Text=cmd.Parameters["@vchEngineModel"].Value.ToString();
            lbEnginePart.Text=cmd.Parameters["@vchEnginePart"].Value.ToString();
            lbEngineSerial.Text=cmd.Parameters["@vchEngineSerial"].Value.ToString();

            lblChasisMake.Text = cmd.Parameters["@vchChasisMake"].Value.ToString();
            lblChasisNumber.Text = cmd.Parameters["@vchChasisNumber"].Value.ToString();

            lbFuelCode.Text=cmd.Parameters["@vchFuelCode"].Value.ToString();
        }