Esempio n. 1
0
        public static string MergePoint(int mergeToPoint, int mergeFrom, string userName)
        {
            string pointCompleted = String.Empty;

            try
            {
                Facade.IPoint         facPoint     = new Facade.Point();
                List <Entities.Point> mergedPoints = new List <Entities.Point>();
                mergedPoints = facPoint.MergePoints(mergeToPoint, mergeFrom.ToString(), userName);

                if (mergedPoints.Count > 0)
                {
                    pointCompleted = mergedPoints[0].PointId + "," + mergedPoints[0].Description + " has been merged successfully.";
                }
                else
                {
                    throw new Exception("Point " + mergeFrom + " could not be merged.");
                }
            }
            catch (Exception ex)
            {
                pointCompleted = mergeFrom + "," + ex.Message;
            }

            return(pointCompleted);
        }
Esempio n. 2
0
        protected void btnMergePoints_Click(object sender, EventArgs e)
        {
            Facade.IPoint         facPoint     = new Facade.Point();
            List <Entities.Point> mergedPoints = new List <Entities.Point>();
            string        userId          = ((Entities.CustomPrincipal)Page.User).UserName;
            RadioButton   rdoButton       = null;
            CheckBox      chkBox          = null;
            string        mergeToPoint    = "";
            StringBuilder mergeFromPoints = new StringBuilder();

            foreach (Telerik.Web.UI.GridItem gi in repPoints.Items)
            {
                rdoButton = (RadioButton)gi.FindControl("btnRadioKeep");
                chkBox    = (CheckBox)gi.FindControl("chkRow");
                if (rdoButton.Checked == true)
                {
                    mergeToPoint = rdoButton.Attributes["PointID"];
                }
                if (chkBox.Checked)
                {
                    if (mergeFromPoints.Length == 0)
                    {
                        mergeFromPoints = mergeFromPoints.Append(chkBox.Attributes["PointID"]);
                    }
                    else
                    {
                        mergeFromPoints = mergeFromPoints.Append("," + chkBox.Attributes["PointID"]);
                    }
                }
            }

            if (mergeFromPoints.Length > 0 && mergeToPoint.Length > 0)
            {
                mergedPoints = facPoint.MergePoints(Convert.ToInt32(mergeToPoint), mergeFromPoints.ToString(), userId);
                repPoints.Rebind();
            }
        }