Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ICRecommendations objICRecommendations = new ICRecommendations();
            objICRecommendations.ICRecommendationDesc = txtICRecommendationDesc.Text;
            objICRecommendations.Status = 1;

            if (!string.IsNullOrEmpty(hfICRecommendationID.Value.ToString()))
            {
                objICRecommendations.UpdatedBy = UserAuthentication.GetUserId(this.Page);
                objICRecommendations.UpdatedDate = DateTime.Now;
                objICRecommendations.ICRecommendationID = Convert.ToInt32(hfICRecommendationID.Value);
                objICRecommendations.ICRecommendationDesc = txtICRecommendationDesc.Text;
                ICRecommendationsBO.UpdateICRecommendations(objICRecommendations);

            }
            else
            {
                objICRecommendations.CreatedBy = UserAuthentication.GetUserId(this.Page);
                objICRecommendations.CreatedDate = DateTime.Now;
                ICRecommendationsBO.InsertICRecommendations(objICRecommendations);
            }

            txtICRecommendationDesc.Text = string.Empty;
            hfICRecommendationID.Value = string.Empty;
            loadICRecommendation();

        }
        // GET api/icrecommendations
        public IEnumerable<ICRecommendations> Get()
        {

            List<ICRecommendations> listICRecommendations = new List<ICRecommendations>();
            DataView dvICRecommendations = ICRecommendationsBO.GetICRecommendationsIDForSync();
            foreach (DataRowView drvICRecommendations in dvICRecommendations)
            {
                ICRecommendations ICRecommendations = new ICRecommendations();
                listICRecommendations.Add(ICRecommendationsBO.GetICRecommendations(Convert.ToInt32(drvICRecommendations["ICRecommendationID"])));
            }
            return listICRecommendations;
        }
        // POST api/icrecommendations
        public ICRecommendations Post(ICRecommendations ICRecommendations)
        {
            if (ICRecommendations.GUID > 0)
            {
                ICRecommendations.ICRecommendationID = ICRecommendations.GUID;
                int rowResult = ICRecommendationsBO.UpdateICRecommendations(ICRecommendations);
                //Return Back to The Client               
                return ICRecommendations;
            }
            else
            {
                int rowResult = ICRecommendationsBO.InsertICRecommendations(ICRecommendations);

                //Return Back to The Client               
                return ICRecommendations;
            }
        }
        public int InsertICRecommendations(ICRecommendations objICRecommendations)
        {
            objICRecommendations.ICRecommendationID = 1;
            BeginTransaction();

            try
            {
                objICRecommendations.ICRecommendationID = Insert(objICRecommendations);
                CommitTransaction();
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                objICRecommendations.ICRecommendationID = -1;
            }

            return objICRecommendations.ICRecommendationID;
        }
Пример #5
0
        protected void gvICRecommendationDesc_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            hfICRecommendationID.Value = e.CommandArgument.ToString();
            ICRecommendations objICRecommendations = new ICRecommendations();

            if (e.CommandName.Equals("cmdEdit"))
            {
                objICRecommendations = ICRecommendationsBO.GetICRecommendations(Convert.ToInt32(e.CommandArgument));
                txtICRecommendationDesc.Text = objICRecommendations.ICRecommendationDesc;
            }
            else if (e.CommandName.Equals("cmdDelete"))
            {
                int ICRecommendationID = Convert.ToInt32(e.CommandArgument);
                objICRecommendations.ICRecommendationID = ICRecommendationID;
                objICRecommendations.Status = 0;
                ICRecommendationsBO.DeleteICRecommendations(objICRecommendations);
                loadICRecommendation();
            }
        }
        public int DeleteICRecommendations(ICRecommendations objICRecommendations)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "Status" };
                rowsaffected = Update(objICRecommendations, UpdateProperties);

                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;

        }
 public static int DeleteICRecommendations(ICRecommendations objICRecommendations)
 {
     return new ICRecommendationsDAO().DeleteICRecommendations(objICRecommendations);
 }
 public static ICRecommendations GetICRecommendations(int ICRecommendationID)
 {
     ICRecommendations objICRecommendations = new ICRecommendations();
     return (ICRecommendations)(new ICRecommendationsDAO().FillDTO(objICRecommendations, "ICRecommendationID=" + ICRecommendationID));
 }
 public static int InsertICRecommendations(ICRecommendations objICRecommendations)
 {
     return new ICRecommendationsDAO().InsertICRecommendations(objICRecommendations);
 }