Exemplo n.º 1
0
        public static ResultBOL <DataSet> GetAll(int menuId)
        {
            string query = string.Format("select * from vw_Projects where MenuId = {0}", menuId);
            ResultBOL <DataSet> result = DataAccessHelpers.ExecuteQuery(query);

            return(result);
        }
Exemplo n.º 2
0
        public static ResultBOL <string> UpdateIndex(OtherTypeUpdateIndexBOL[] list)
        {
            string stored = "sp_OtherType_Insert_Update";

            ResultBOL <string> result = new ResultBOL <string>();

            foreach (OtherTypeUpdateIndexBOL obj in list)
            {
                var updateResult = DataAccessHelpers.ExecuteStored(stored, obj.GetParameters());
                if (updateResult.Code < 0)
                {
                    if (string.IsNullOrEmpty(result.ErrorMessage))
                    {
                        result.ErrorMessage = updateResult.ErrorMessage;
                    }
                    else
                    {
                        result.ErrorMessage += "\n" + updateResult.ErrorMessage;
                    }
                }
            }

            if (!string.IsNullOrEmpty(result.ErrorMessage))
            {
                result.Code = -1;
            }

            return(result);
        }
Exemplo n.º 3
0
        public static ResultBOL <DataSet> GetAll()
        {
            string query = "select * from vw_Projects";
            ResultBOL <DataSet> result = DataAccessHelpers.ExecuteQuery(query);

            return(result);
        }
Exemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            string tag = "[AddContactHandler][ProcessRequest]";

            LogHelpers.WriteStatus(tag, "Start...");
            //---
            ResultBOL <int> result;

            try
            {
                StreamReader reader      = new StreamReader(context.Request.InputStream);
                string       jsonRequest = reader.ReadToEnd();
                //---
                ContactBOL contact = JsonConvert.DeserializeObject <ContactBOL>(jsonRequest);
                contact.InsertDate  = DateTime.Now;
                contact.UpdatedDate = DateTime.Now;
                //--
                result = ContactsDAL.InsertOrUpdate(contact);
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
                result = new ResultBOL <int>()
                {
                    Code         = ex.HResult,
                    ErrorMessage = ex.Message
                };
            }

            string jsonResponse = JsonConvert.SerializeObject(result);

            context.Response.ContentType = "application/json";
            context.Response.Write(jsonResponse);
        }
Exemplo n.º 5
0
        public static ResultBOL <DataSet> GetAll()
        {
            string query = "select * from OtherType select * from Other where IsGroup = 1";
            ResultBOL <DataSet> result = DataAccessHelpers.ExecuteQuery(query);

            return(result);
        }
Exemplo n.º 6
0
        public static ResultBOL <int> InsertOrUpdate(GalleryBOL obj)
        {
            string          stored = "sp_Galley_Insert_Update";
            ResultBOL <int> result = DataAccessHelpers.ExecuteStored(stored, obj);

            if (result.Code < 0)
            {
                _log.Error(result.ErrorMessage);
            }
            else
            {
                obj.Id = result.Data;
            }

            return(result);
        }
Exemplo n.º 7
0
        private void GetLogo()
        {
            ResultBOL <DataSet> result = AboutsDAL.Get();

            if (result.Code < 0)
            {
                _log.Error(result.ErrorMessage);
            }
            else if (result.Data != null && result.Data.Tables.Count > 0 && result.Data.Tables[0].Rows.Count > 0)
            {
                AboutBOL about = new AboutBOL(result.Data.Tables[0].Rows[0]);
                if (!string.IsNullOrEmpty(about.ImageLink))
                {
                    this.imgLogo.Src = "~/" + Path.Combine(Utilities.GetDirectory("ImagesDir"), about.ImageLink);
                }
            }
        }
Exemplo n.º 8
0
        public static int GetId(string type)
        {
#if DEBUG
            _log.Debug("type: {0}", type);
#endif
            string             query  = string.Format("select Id from Menu where [Type] like '{0}' and (ParentId is null or ParentId < 1)", type);
            ResultBOL <object> result = DataAccessHelpers.ExecuteScalar(query);
            if (result.Code < 0)
            {
                _log.Error(result.ErrorMessage);
            }
            else if (result.Data != null)
            {
                return(int.Parse(result.Data.ToString()));
            }

            return(int.MinValue);
        }
Exemplo n.º 9
0
        public void StartBidingOtherType(int id)
        {
            string tag = __tag + "[StartBidingOtherType]";

            LogHelpers.WriteStatus(tag, "Start...");

            lbError.Visible = false;

            try
            {
                ResultBOL <DataSet> result = null;
                if (id <= 0)
                {
                    result = OtherTypeDAL.GetAll();
                }
                else
                {
                    result = OtherDAL.GetAll(id);
                }

                if (result.Code < 0)
                {
                    lbError.InnerText = result.ErrorMessage;
                    lbError.Visible   = true;
                    return;
                }

                _dataSource = result.Data.Tables[0];
                grvOtherItems.DataSource   = result.Data;
                grvOtherItems.DataKeyNames = new string[] { "Id" };
                grvOtherItems.DataBind();
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
                lbError.InnerText = ex.Message;
                lbError.Visible   = true;
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }
        }
Exemplo n.º 10
0
        public static ResultBOL <DataSet> GetAllGroup(int menuId)
        {
#if DEBUG
            _log.Debug("menuId: {0}", menuId);
#endif
            string query = "select * from Other where IsGroup = 1";
            if (menuId > 0)
            {
                query += " and ParentId = " + menuId.ToString();
            }


            ResultBOL <DataSet> result = DataAccessHelpers.ExecuteQuery(query);
            if (result.Code < 0)
            {
                _log.Error(result.ErrorMessage);
            }

            return(result);
        }