Exemple #1
0
        public OptimalCondtionViewModel(string cost_centercode)
        {
            UserInformation user = (UserInformation)App.Current.Properties["userinfo"];

            userinformation = user;
            CostCenterCode  = cost_centercode;
            //   CostCenterCode = Cost_CenterCode;
            optimalModel = new OptimalConditionBll(userinformation);
            //   modelOptimal = new DDOPTIMAL_COND();
            this.updateOperMastCommand = new DelegateCommand(this.CommonFormValUpdtae);
            this.alertCommand          = new DelegateCommand(this.KeyPressalertCommand);
            this.enterClickCommand     = new DelegateCommand(this.EnterKeyPress);

            this.rowEditEndingSubTypeCommand = new DelegateCommand <Object>(this.RowEditEndingSubType);

            GridData      = optimalModel.GetOptimalMaster(CostCenterCode);
            SelectedIndex = GridData.Rows.Count - 1;

            if (GridData == null || GridData.Rows.Count == 0)
            {
                DataRow newrow = GridData.NewRow();
                GridData.Rows.InsertAt(newrow, 0);
                GridData.Rows[0]["SER_NO"] = 1;
                GridData.AcceptChanges();
            }
        }
Exemple #2
0
        public void GridDataAddRows(Object selecteditem)
        {
            DataRow dr;


            selecteditem = (DataRowView)selecteditem;


            // DataRow DR=new DataRow();
            int currentrow;

            currentrow = GridData.Rows.Count;


            int rowindex;

            if (currentrow == 0)
            {
                DataRow newrow = GridData.NewRow();
                GridData.Rows.InsertAt(newrow, 0);
                GridData.Rows[0]["SER_NO"] = 1;
                GridData.AcceptChanges();
            }
            else
            {
                dr = GridData.Rows[currentrow - 1];
                if (dr["ILLUSTRATION"].ToString().Trim() != "" || dr["AREA"].ToString().Trim() != "" || dr["REQD_COND"].ToString().Trim() != "" || dr["METHOD"].ToString().Trim() != "" || dr["RESP"].ToString().Trim() != "" || dr["FREQUENCY"].ToString().Trim() != "" || dr["TIME_ALLOWED"].ToString().Trim() != "")
                {
                    // if (DR["CHARACTERISTIC"].ToString().Trim() != "")
                    //{
                    rowindex = GridData.Rows.Count;
                    DataRow newrow = GridData.NewRow();
                    bool    retval = true;
                    // retval = CheckGridDuplicate(RowIndex);
                    if (retval == true)
                    {
                        newrow["SER_NO"] = GridData.Rows.Count + 1;
                        GridData.Rows.InsertAt(newrow, rowindex);
                    }
                    //}
                }
            }
            //   firstCell = true;
        }
Exemple #3
0
        public void GridDataAddRows(Object selecteditem)
        {
            DataRow dr;


            selecteditem = (DataRowView)selecteditem;


            // DataRow DR=new DataRow();
            int currentrow;

            currentrow = GridData.Rows.Count;


            int rowindex;

            if (currentrow == 0)
            {
                DataRow newrow = GridData.NewRow();
                GridData.Rows.InsertAt(newrow, 0);
                GridData.Rows[0]["SER_NO"] = 1;
                GridData.AcceptChanges();
            }
            else
            {
                dr = GridData.Rows[currentrow - 1];
                if (dr["PART_REP_ADJ"].ToString().Trim() != "" || dr["AREA"].ToString().Trim() != "" || dr["OPTIMAL_COND"].ToString().Trim() != "" || dr["RESP"].ToString().Trim() != "" || dr["FREQUENCY"].ToString().Trim() != "" || dr["NORMAL"].ToString().Trim() != "" || dr["COUNTER_MEAS"].ToString().Trim() != "")
                {
                    rowindex = GridData.Rows.Count;
                    DataRow newrow = GridData.NewRow();
                    bool    retval = true;
                    if (retval == true)
                    {
                        newrow["SER_NO"] = GridData.Rows.Count + 1;
                        GridData.Rows.InsertAt(newrow, rowindex);
                    }
                }
            }
        }
Exemple #4
0
        public StatndardConditionViewModel(string cost_centercode, string category_id)
        {
            UserInformation user = (UserInformation)App.Current.Properties["userinfo"];

            userinformation = user;
            CostCenterCode  = cost_centercode;
            CategoryId      = category_id;
            if (category_id == "1")
            {
                Standard = "Cleaning";
            }
            if (category_id == "2")
            {
                Standard = "Inspection";
            }
            if (category_id == "3")
            {
                Standard = "Lubrication";
            }


            stdcondition = new StandardConditionBll(userinformation);
            this.updateOperMastCommand       = new DelegateCommand(this.CommonFormValUpdtae);
            this.rowEditEndingSubTypeCommand = new DelegateCommand <Object>(this.RowEditEndingSubType);

            // this.textBoxValueChanged = new DelegateCommand<Object>(this.TextChanged);
            // this.textBoxValueChanged1 = new DelegateCommand<Object>(this.TextChanged1);
            // this.textBoxValueChanged2 = new DelegateCommand<Object>(this.TextChanged2);


            GridMainData = stdcondition.GetStandard_Main(CostCenterCode, category_id);
            GridData     = stdcondition.GetStandSubMaster(CostCenterCode, category_id);

            string sysUIFormat = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;

            if (GridData == null || GridData.Rows.Count == 0)
            {
                DataRow newrow = GridData.NewRow();
                GridData.Rows.InsertAt(newrow, 0);
                GridData.Rows[0]["SER_NO"] = 1;
                GridData.AcceptChanges();
            }

            if (GridMainData.Rows.Count > 0)
            {
                CATEGORY = GridMainData.Rows[0]["CATEGORY"].ToString();
                if (GridMainData.Rows[0]["DATE_MADE"] != DBNull.Value)
                {
                    DateTime d;
                    string   dstr = Convert.ToString(GridMainData.Rows[0]["DATE_MADE"]);
                    DateTime.TryParse(dstr, out d);
                    if (d != null)
                    {
                        DATE_MADE = d.Date;
                    }
                }
                if (GridMainData.Rows[0]["VALID_UPTO"] != DBNull.Value)
                {
                    DateTime d;
                    string   dstr = Convert.ToString(GridMainData.Rows[0]["VALID_UPTO"]);
                    DateTime.TryParse(dstr, out d);
                    if (d != null)
                    {
                        VALID_UPTO = d.Date;
                    }
                }

                if (GridMainData.Rows[0]["REVISION_DATE"] != DBNull.Value)
                {
                    DateTime d;
                    string   dstr = Convert.ToString(GridMainData.Rows[0]["REVISION_DATE"]);
                    DateTime.TryParse(dstr, out d);
                    if (d != null)
                    {
                        REVISION_DATE = d.Date;
                    }
                }
                REVISION_NO = GridMainData.Rows[0]["REVISION_NO"].ToString();
            }
        }