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

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

            try
            {
                // вызов статического метода из класса, связанного с БД
                System.Data.DataTable dtList = CIntWaybillStateDataBaseModel.GetWaybillStateList(objProfile, null, ref strErr);
                if (dtList != null)
                {
                    CIntWaybillState objListItem = null;
                    foreach (System.Data.DataRow objItem in dtList.Rows)
                    {
                        objListItem                   = new CIntWaybillState();
                        objListItem.ID                = new Guid(System.Convert.ToString(objItem["IntWaybillState_Guid"]));
                        objListItem.Name              = ((objItem["IntWaybillState_Name"] == System.DBNull.Value) ? "" : System.Convert.ToString(objItem["IntWaybillState_Name"]));
                        objListItem.Description       = ((objItem["IntWaybillState_Description"] == System.DBNull.Value) ? "" : System.Convert.ToString(objItem["IntWaybillState_Description"]));
                        objListItem.IntWaybillStateId = ((objItem["IntWaybillState_Id"] == System.DBNull.Value) ? 0 : System.Convert.ToInt32(System.Convert.ToString(objItem["IntWaybillState_Id"])));

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

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

                        objList.Add(objListItem);
                    }
                }

                dtList = null;
            }

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