Beispiel #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 = CWaybillShipModeDataBaseModel.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);
        }
Beispiel #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 = CWaybillShipModeDataBaseModel.EditObjectInDataBase(this.ID,
                                                                                     this.Name, this.Description, this.IsActive, this.IsDefault, this.WaybillShipModeId, objProfile, ref strErr);
            if (bRet == false)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(strErr, "Внимание",
                                                           System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }

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

            try
            {
                // вызов статического метода из класса, связанного с БД
                System.Data.DataTable dtList = CWaybillShipModeDataBaseModel.GetWaybillShipModeList(objProfile, null, ref strErr);
                if (dtList != null)
                {
                    CWaybillShipMode objListItem = null;
                    foreach (System.Data.DataRow objItem in dtList.Rows)
                    {
                        objListItem                   = new CWaybillShipMode();
                        objListItem.ID                = new Guid(System.Convert.ToString(objItem["WaybillShipMode_Guid"]));
                        objListItem.Name              = ((objItem["WaybillShipMode_Name"] == System.DBNull.Value) ? "" : System.Convert.ToString(objItem["WaybillShipMode_Name"]));
                        objListItem.Description       = ((objItem["WaybillShipMode_Description"] == System.DBNull.Value) ? "" : System.Convert.ToString(objItem["WaybillShipMode_Description"]));
                        objListItem.WaybillShipModeId = ((objItem["WaybillShipMode_Id"] == System.DBNull.Value) ? 0 : System.Convert.ToInt32(System.Convert.ToString(objItem["WaybillShipMode_Id"])));

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

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

                        objList.Add(objListItem);
                    }
                }

                dtList = null;
            }

            catch (System.Exception f)
            {
                strErr += (String.Format(" {0}", f.Message));
            }
            return(objList);
        }
Beispiel #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 = CWaybillShipModeDataBaseModel.AddNewObjectToDataBase(
                this.Name, this.Description, this.IsActive, this.IsDefault,
                this.WaybillShipModeId, 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);
        }