Exemple #1
0
        /// <summary>
        /// Удалить запись из БД
        /// </summary>
        /// <param name="objProfile">профайл</param>
        /// <param name="uuidID">уникальный идентификатор объекта</param>
        /// <returns>true - удачное завершение; false - ошибка</returns>
        public override System.Boolean Remove(UniXP.Common.CProfile objProfile)
        {
            System.String strErr = "";

            System.Boolean bRet = CBackWaybillStateDataBaseModel.RemoveObjectFromDataBase(this.ID, objProfile, ref strErr);
            if (bRet == false)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(strErr, "Внимание",
                                                           System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }

            return(bRet);
        }
Exemple #2
0
        /// <summary>
        /// Сохранить изменения в БД
        /// </summary>
        /// <param name="objProfile">профайл</param>
        /// <returns>true - удачное завершение; false - ошибка</returns>
        public override System.Boolean Update(UniXP.Common.CProfile objProfile)
        {
            System.String strErr = "";

            System.Boolean bRet = CBackWaybillStateDataBaseModel.EditObjectInDataBase(this.ID,
                                                                                      this.Name, this.Description, this.IsActive, this.IsDefault, this.BackWaybillStateId, objProfile, ref strErr);
            if (bRet == false)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(strErr, "Внимание",
                                                           System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }

            return(bRet);
        }
Exemple #3
0
        /// <summary>
        /// Возвращает список состояний возвратной накладной
        /// </summary>
        /// <param name="objProfile">профайл</param>
        /// <param name="cmdSQL">SQL-команда</param>
        /// <param name="strErr">сообщение об ошибке</param>
        /// <returns>список состояний возвратной накладной</returns>
        public static List <CBackWaybillState> GetBackWaybillStateList(UniXP.Common.CProfile objProfile, ref System.String strErr)
        {
            List <CBackWaybillState> objList = new List <CBackWaybillState>();

            try
            {
                // вызов статического метода из класса, связанного с БД
                System.Data.DataTable dtList = CBackWaybillStateDataBaseModel.GetBackWaybillStateList(objProfile, null, ref strErr);
                if (dtList != null)
                {
                    CBackWaybillState objListItem = null;
                    foreach (System.Data.DataRow objItem in dtList.Rows)
                    {
                        objListItem                    = new CBackWaybillState();
                        objListItem.ID                 = new Guid(System.Convert.ToString(objItem["BackWaybillState_Guid"]));
                        objListItem.Name               = ((objItem["BackWaybillState_Name"] == System.DBNull.Value) ? "" : System.Convert.ToString(objItem["BackWaybillState_Name"]));
                        objListItem.Description        = ((objItem["BackWaybillState_Description"] == System.DBNull.Value) ? "" : System.Convert.ToString(objItem["BackWaybillState_Description"]));
                        objListItem.BackWaybillStateId = ((objItem["BackWaybillState_Id"] == System.DBNull.Value) ? 0 : System.Convert.ToInt32(System.Convert.ToString(objItem["BackWaybillState_Id"])));

                        if (objItem["BackWaybillState_IsActive"] != System.DBNull.Value)
                        {
                            objListItem.IsActive = System.Convert.ToBoolean(System.Convert.ToString(objItem["BackWaybillState_IsActive"]));
                        }

                        if (objItem["BackWaybillState_IsDefault"] != System.DBNull.Value)
                        {
                            objListItem.IsDefault = System.Convert.ToBoolean(System.Convert.ToString(objItem["BackWaybillState_IsDefault"]));
                        }

                        objList.Add(objListItem);
                    }
                }

                dtList = null;
            }

            catch (System.Exception f)
            {
                strErr += (String.Format(" {0}", f.Message));
            }
            return(objList);
        }
Exemple #4
0
        /// <summary>
        /// Добавить запись в БД
        /// </summary>
        /// <param name="objProfile">профайл</param>
        /// <returns>true - удачное завершение; false - ошибка</returns>
        public override System.Boolean Add(UniXP.Common.CProfile objProfile)
        {
            System.String strErr = "";

            System.Guid GUID_ID = System.Guid.Empty;

            System.Boolean bRet = CBackWaybillStateDataBaseModel.AddNewObjectToDataBase(
                this.Name, this.Description, this.IsActive, this.IsDefault,
                this.BackWaybillStateId, ref GUID_ID, objProfile, ref strErr);
            if (bRet == true)
            {
                this.ID = GUID_ID;
            }
            else
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(strErr, "Внимание",
                                                           System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }

            return(bRet);
        }