Esempio n. 1
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            StockLocationVo inVo = (StockLocationVo)arg;

            StockLocationVo outVo = new StockLocationVo();

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Update m_stock_location");
            sqlQuery.Append(" Set ");
            sqlQuery.Append(" stock_location_name = :stock_locationname, ");
            sqlQuery.Append(" location_type = :locationtype, ");
            sqlQuery.Append(" display_order = :displayorder ");
            sqlQuery.Append(" Where	");
            sqlQuery.Append(" stock_location_id = :stock_locationid ");
            sqlQuery.Append(" and factory_cd = :faccd ;");
            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterInteger("stock_locationid", inVo.StockLocationId);
            sqlParameter.AddParameterString("stock_locationname", inVo.StockLocationName);
            sqlParameter.AddParameterInteger("locationtype", inVo.LocationType);
            sqlParameter.AddParameterInteger("displayorder", inVo.DisplayOrder);
            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);
            //execute SQL
            outVo.AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter);

            return(outVo);
        }
Esempio n. 2
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Select  max(display_order)+1 display_order ");
            sqlQuery.Append(" from m_stock_location sl ");
            sqlQuery.Append(" where sl.factory_cd = :factcd");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("factcd", UserData.GetUserData().FactoryCode);

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            StockLocationVo outVo = null;

            while (dataReader.Read())
            {
                outVo = new StockLocationVo();
                outVo.DisplayOrder = ConvertDBNull <int>(dataReader, "display_order");
            }
            dataReader.Close();

            return(outVo);
        }
Esempio n. 3
0
        /// <summary>
        /// form load, loads item data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AddStockLocationForm_Load(object sender, EventArgs e)
        {
            if (!this.DesignMode)
            {
                StockLocationCode_txt.Select();

                LoadUnityType();
                LoadLocationType();

                if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                {
                    LoadUserData(updateData);

                    StockLocationCode_txt.Enabled = false;

                    StockLocationName_txt.Select();

                    var resourceMngr = new ResourceManager(this.GetType());
                    this.Text = resourceMngr.GetString("UpdateForm");
                }
                else
                {
                    StockLocationVo outVo = (StockLocationVo)base.InvokeCbm(new GetDisplayOrderNextValForStockLocCbm(), null, false);
                    if (outVo != null)
                    {
                        DisplayOrder_txt.Text = outVo.DisplayOrder.ToString();
                    }
                    else
                    {
                        DisplayOrder_txt.Text = "1";
                    }
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// selects item record for updation and show item form
        /// </summary>
        private void BindUpdateUserData()
        {
            int selectedrowindex = StockLocationData_dgv.SelectedCells[0].RowIndex;

            StockLocationVo selectedData = (StockLocationVo)StockLocationData_dgv.Rows[selectedrowindex].DataBoundItem;

            AddStockLocationForm newAddForm = new AddStockLocationForm();

            newAddForm.CreateForm(CommonConstants.MODE_UPDATE, selectedData);

            newAddForm.ShowDialog(this);

            if (newAddForm.IntSuccess > 0)
            {
                messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);

                GridBind(FormConditionVo());
            }
            else if (newAddForm.IntSuccess == 0)
            {
                messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);
                GridBind(FormConditionVo());
            }
        }
Esempio n. 5
0
        public AddStockLocationForm  CreateForm(string pmode, StockLocationVo dataItem = null)
        {
            mode = pmode;

            updateData = dataItem;

            return(new AddStockLocationForm());
        }
Esempio n. 6
0
 /// <summary>
 /// For setting selected user record into respective controls(textbox and combobox) for update operation
 /// passing selected user data as parameter
 /// </summary>
 /// <param name="dgvData"></param>
 private void LoadUserData(StockLocationVo dgvData)
 {
     if (dgvData != null)
     {
         StockLocationCode_txt.Text = dgvData.StockLocationCode;
         StockLocationName_txt.Text = dgvData.StockLocationName;
         DisplayOrder_txt.Text      = dgvData.DisplayOrder.ToString();
         if (dgvData.LocationTypeDisplay != null)
         {
             LocationType_cmb.Text = dgvData.LocationTypeDisplay.ToString();
         }
     }
 }
Esempio n. 7
0
        /// <summary>
        /// event to delete the selected record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Delete_btn_Click(object sender, EventArgs e)
        {
            int selectedrowindex = StockLocationData_dgv.SelectedCells[0].RowIndex;

            DataGridViewRow selectedRow = StockLocationData_dgv.Rows[selectedrowindex];

            messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colStockLocationCode"].Value.ToString());
            logger.Info(messageData);
            DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text);

            if (dialogResult == DialogResult.OK)
            {
                StockLocationVo inVo = new StockLocationVo
                {
                    StockLocationId = Convert.ToInt32(selectedRow.Cells["colStockLocationId"].Value),
                };

                inVo.StockLocationCode = selectedRow.Cells["colStockLocationCode"].Value.ToString();
                try
                {
                    StockLocationVo outVo = (StockLocationVo)base.InvokeCbm(new DeleteStockLocationMasterMntCbm(), inVo, false);

                    if (outVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);

                        GridBind(FormConditionVo());
                    }
                    else if (outVo.AffectedCount == 0)
                    {
                        messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);
                        GridBind(FormConditionVo());
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                }
            }
            else if (dialogResult == DialogResult.Cancel)
            {
                //do something else
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Creates seacrh condition as per user inputs
        /// </summary>
        /// <returns>search condition</returns>
        private StockLocationVo FormConditionVo()
        {
            StockLocationVo inVo = new StockLocationVo();

            if (StockLocationCode_txt.Text != string.Empty)
            {
                inVo.StockLocationCode = StockLocationCode_txt.Text;
            }

            if (StockLocationName_txt.Text != string.Empty)
            {
                inVo.StockLocationName = StockLocationName_txt.Text;
            }

            return(inVo);
        }
Esempio n. 9
0
        /// <summary>
        /// check duplicate Display Record
        /// </summary>
        /// <param name="defectVo"></param>
        /// <returns></returns>
        private StockLocationVo DuplicateDisplayCheck(StockLocationVo chkvo)
        {
            StockLocationVo outVo = new StockLocationVo();

            try
            {
                outVo = (StockLocationVo)base.InvokeCbm(new CheckStockLocationDisplayMasterMntCbm(), chkvo, false);
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }

            return(outVo);
        }
Esempio n. 10
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            StockLocationVo inVo = (StockLocationVo)arg;

            StockLocationVo outVo = new StockLocationVo();

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Insert into m_stock_location");
            sqlQuery.Append(" ( ");
            sqlQuery.Append(" stock_location_code, ");
            sqlQuery.Append(" stock_location_name, ");
            sqlQuery.Append(" display_order, ");
            sqlQuery.Append(" location_type, ");
            sqlQuery.Append(" registration_user_cd, ");
            sqlQuery.Append(" registration_date_time, ");
            sqlQuery.Append(" factory_cd ");
            sqlQuery.Append(" ) ");
            sqlQuery.Append("VALUES	");
            sqlQuery.Append(" ( ");
            sqlQuery.Append(" :stocklocationcode ,");
            sqlQuery.Append(" :stocklocationname ,");
            sqlQuery.Append(" :Displayorder ,");
            sqlQuery.Append(" :locationtype ,");
            sqlQuery.Append(" :registrationusercode ,");
            sqlQuery.Append(" now() ,");
            sqlQuery.Append(" :factorycode ");
            sqlQuery.Append(" ) ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("stocklocationcode", inVo.StockLocationCode);
            sqlParameter.AddParameterString("stocklocationname", inVo.StockLocationName);
            sqlParameter.AddParameterInteger("Displayorder", inVo.DisplayOrder);
            sqlParameter.AddParameterInteger("locationtype", inVo.LocationType);
            sqlParameter.AddParameterString("registrationusercode", inVo.RegistrationUserCode);
            //sqlParameter.AddParameterDateTime("registrationdatetime", inVo.RegistrationDateTime);
            sqlParameter.AddParameterString("factorycode", inVo.FactoryCode);

            outVo.AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter);

            return(outVo);
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            StockLocationVo inVo = (StockLocationVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Select Count(*) as StockLocationCount from m_stock_location ");
            sqlQuery.Append(" where factory_cd = :faccd ");

            if (inVo.StockLocationCode != null)
            {
                sqlQuery.Append(" and UPPER(stock_location_code) = UPPER(:stock_locationcd)");
            }

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);
            if (inVo.StockLocationCode != null)
            {
                sqlParameter.AddParameterString("stock_locationcd", inVo.StockLocationCode);
            }

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            StockLocationVo outVo = new StockLocationVo();

            while (dataReader.Read())
            {
                outVo.AffectedCount = Convert.ToInt32(dataReader["StockLocationCount"]);
            }

            dataReader.Close();

            return(outVo);
        }
Esempio n. 12
0
        /// <summary>
        /// Fills all user records to gridview control
        /// </summary>
        private void GridBind(StockLocationVo conditionInVo)
        {
            StockLocationData_dgv.DataSource = null;

            try
            {
                ValueObjectList <StockLocationVo> outVo = (ValueObjectList <StockLocationVo>)base.InvokeCbm(new GetStockLocationMasterMntCbm(), conditionInVo, false);

                if (outVo != null)
                {
                    StockLocationData_dgv.AutoGenerateColumns = false;

                    BindingSource bindingSource1 = new BindingSource(outVo.GetList(), null);

                    if (bindingSource1.Count > 0)
                    {
                        StockLocationData_dgv.DataSource = bindingSource1;
                    }
                }
                else
                {
                    messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                }

                StockLocationData_dgv.ClearSelection();

                Update_btn.Enabled = false;

                Delete_btn.Enabled = false;
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            StockLocationVo inVo = (StockLocationVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Delete From m_stock_location");
            sqlQuery.Append(" Where	");
            sqlQuery.Append(" stock_location_id = :stocklocationid ");
            sqlQuery.Append(" and factory_cd = :faccd ;");
            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterInteger("stocklocationid", inVo.StockLocationId);
            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);
            StockLocationVo outVo = new StockLocationVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Esempio n. 14
0
        /// <summary>
        /// inserts/updates item details
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Ok_btn_Click(object sender, EventArgs e)
        {
            if (CheckMandatory())
            {
                StockLocationVo inVo = new StockLocationVo
                {
                    StockLocationCode = StockLocationCode_txt.Text,
                    StockLocationName = StockLocationName_txt.Text,
                    //RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),
                    LocationType         = Convert.ToInt32(LocationType_cmb.SelectedValue.ToString()),
                    DisplayOrder         = Convert.ToInt32(DisplayOrder_txt.Text),
                    RegistrationUserCode = UserData.GetUserData().UserCode,
                    FactoryCode          = UserData.GetUserData().FactoryCode
                };

                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    StockLocationVo checkVo = DuplicateCheck(inVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, StockLocationCode_lbl.Text + " : " + StockLocationCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ApplicationError(messageData, Text);
                        return;
                    }

                    StockLocationVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                    if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DisplayOrder_lbl.Text + " : " + DisplayOrder_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);
                        DisplayOrder_txt.Focus();
                        return;
                    }
                }

                else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                {
                    if (updateData.DisplayOrder != Convert.ToInt32(DisplayOrder_txt.Text))
                    {
                        StockLocationVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                        if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DisplayOrder_lbl.Text + " : " + DisplayOrder_txt.Text);
                            logger.Info(messageData);
                            popUpMessage.ConfirmationOkCancel(messageData, Text);
                            DisplayOrder_txt.Focus();
                            return;
                        }
                    }
                }


                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        StockLocationVo outVo = (StockLocationVo)base.InvokeCbm(new AddStockLocationMasterMntCbm(), inVo, false);

                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        inVo.StockLocationId = updateData.StockLocationId;

                        StockLocationVo outVo = (StockLocationVo)base.InvokeCbm(new UpdateStockLocationMasterMntCbm(), inVo, false);

                        IntSuccess = outVo.AffectedCount;
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }

                if ((IntSuccess > 0) || (IntSuccess == 0))
                {
                    this.Close();
                }
            }
        }
Esempio n. 15
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            StockLocationVo inVo = (StockLocationVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            //create SQL
            sqlQuery.Append(" Select li.stock_location_id, li.stock_location_code, li.stock_location_name, ");
            sqlQuery.Append(" CASE ");
            sqlQuery.Append(" WHEN location_type = 0 THEN 'Process' ");
            sqlQuery.Append(" WHEN location_type = 1 THEN 'Warehouse' ");
            sqlQuery.Append(" END as locationtype, ");
            sqlQuery.Append(" display_order ");
            sqlQuery.Append(" from m_stock_location li ");
            sqlQuery.Append(" where factory_cd = :faccd ");

            if (inVo.StockLocationCode != null)
            {
                sqlQuery.Append(" and stock_location_code like :stocklocationcd ");
            }

            if (inVo.StockLocationName != null)
            {
                sqlQuery.Append(" and stock_location_name like :stocklocationname ");
            }

            sqlQuery.Append(" order by stock_location_code ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);
            if (inVo.StockLocationCode != null)
            {
                sqlParameter.AddParameterString("stocklocationcd", inVo.StockLocationCode + "%");
            }

            if (inVo.StockLocationName != null)
            {
                sqlParameter.AddParameterString("stocklocationname", inVo.StockLocationName + "%");
            }

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            ValueObjectList <StockLocationVo> outVo = null;

            while (dataReader.Read())
            {
                if (outVo == null)
                {
                    outVo = new ValueObjectList <StockLocationVo>();
                }
                StockLocationVo currOutVo = new StockLocationVo
                {
                    StockLocationId     = ConvertDBNull <int>(dataReader, "stock_location_id"),
                    StockLocationCode   = ConvertDBNull <string>(dataReader, "stock_location_code"),
                    StockLocationName   = ConvertDBNull <string>(dataReader, "stock_location_name"),
                    LocationTypeDisplay = ConvertDBNull <string>(dataReader, "locationtype"),
                    DisplayOrder        = ConvertDBNull <int>(dataReader, "display_order")
                };

                outVo.add(currOutVo);
            }
            dataReader.Close();

            return(outVo);
        }