protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string        httpMehtod  = Request.HttpMethod;
         UnitFwService unitService = new UnitFwService();
         string        unitId      = ConvertUtility.Trim(Request.QueryString["id"]);
         if (httpMehtod.Equals("get", StringComparison.OrdinalIgnoreCase))
         {
             this.Unit = unitService.GetUnit(unitId);
         }
         else
         {
             float  area      = ConvertUtility.ToFloat(Request.Form["area"]);
             int    countf    = ConvertUtility.ToInt(Request.Form["countf"]);
             int    countt    = ConvertUtility.ToInt(Request.Form["countt"]);
             int    countw    = ConvertUtility.ToInt(Request.Form["countw"]);
             int    county    = ConvertUtility.ToInt(Request.Form["county"]);
             string direction = ConvertUtility.Trim(Request.Form["directionTo"]);
             if (unitService.UpdateUnit(unitId, countf, countt, countw, county, direction, area))
             {
                 Response.Write("true");
             }
             else
             {
                 Response.Write("false");
             }
             Response.End();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        static int CompareUnit(string agencyCom_BuildId, string framework_BuildId)
        {
            int               buildStatus       = ComparedStatus.DEFAULT;
            UnitCmService     unitCmService     = new UnitCmService();
            List <UnitCmType> agencyComUnitList = null;
            UnitFwService     unitFwService     = new UnitFwService();
            List <UnitFwType> frameworkUnitList = null;

            if (!string.IsNullOrEmpty(agencyCom_BuildId) && !string.IsNullOrEmpty(framework_BuildId))
            {
                frameworkUnitList = unitFwService.ListUnitByCm(agencyCom_BuildId, framework_BuildId).ToList();
                agencyComUnitList = unitCmService.ListUnit(agencyCom_BuildId).ToList();
            }
            else if (!string.IsNullOrEmpty(agencyCom_BuildId))
            {
                agencyComUnitList = unitCmService.ListUnit(agencyCom_BuildId).ToList();
            }
            else if (!string.IsNullOrEmpty(framework_BuildId))
            {
                frameworkUnitList = unitFwService.ListUnitByCm(agencyCom_BuildId, framework_BuildId).ToList();
            }
            if (frameworkUnitList != null && frameworkUnitList.Count > 0)
            {
                frameworkUnitList.ForEach(frameworkUnit =>
                {
                    if (agencyComUnitList != null && agencyComUnitList.Count > 0)
                    {
                        var agencyComUnit = agencyComUnitList.Find(item => item.CX_Axis == frameworkUnit.CX_Axis && item.CY_Axis == frameworkUnit.CY_Axis);
                        if (agencyComUnit != null)
                        {
                            agencyComUnitList.RemoveAll(item => item.CX_Axis == frameworkUnit.CX_Axis && item.CY_Axis == frameworkUnit.CY_Axis);
                            unitCmService.InsertComparedUnit(agencyComUnit, frameworkUnit, ComparedStatus.DEFAULT);
                        }
                        else
                        {
                            unitCmService.InsertComparedUnit(null, frameworkUnit, ComparedStatus.ADDNEW);
                            buildStatus = ComparedStatus.DEFAULT_MISS;
                        }
                    }
                    else
                    {
                        unitCmService.InsertComparedUnit(null, frameworkUnit, ComparedStatus.ADDNEW);
                        buildStatus = ComparedStatus.DEFAULT_MISS;
                    }
                });
            }
            //delete
            if (agencyComUnitList != null && agencyComUnitList.Count > 0)
            {
                agencyComUnitList.ForEach(agencyComUnit =>
                {
                    unitCmService.InsertComparedUnit(agencyComUnit, null, ComparedStatus.DELETE);
                    buildStatus = ComparedStatus.DEFAULT_CLEAR;
                });
            }
            return(buildStatus);
        }
Ejemplo n.º 3
0
        static void Unit_C2F(UnitCtType unitCtType)
        {
            //
            DateTime      begin         = DateTime.Now;
            UnitFwType    unitFwType    = new UnitFwType(unitCtType);
            UnitFwService unitFwService = new UnitFwService();

            unitFwService.ImportUnit(unitFwType);
            DateTime end = DateTime.Now;
        }
Ejemplo n.º 4
0
 public static bool Fill(string id, string cx_axis, string cy_axis)
 {
     try
     {
         MemberService memberService = new MemberService();
         string        createBy      = memberService.GetUserInfo().UserId;
         UnitFwService service       = new UnitFwService();
         if (service.AddUnit(id, cx_axis, cy_axis))
         {
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    this.BuildId = ConvertUtility.Trim(Request.QueryString["id"]);
                    BuildFwService buildService = new BuildFwService();
                    BuildFw        build        = buildService.GetBuild(this.BuildId);
                    this.TitleBar = build.ToNavBar(false);

                    UnitFwService      unitService = new UnitFwService();
                    List <string>      rows        = unitService.ListFloor(this.BuildId);
                    List <string>      cols        = unitService.ListRoom(this.BuildId);
                    IList <UnitFwType> unit_all    = unitService.ListUnit(this.BuildId);

                    this.Rows    = rows;
                    this.Columns = cols;
                    this.model   = new UnitFwType[rows.Count, cols.Count];

                    string floor = string.Empty;
                    string room  = string.Empty;
                    for (int rowIndex = 0; rowIndex < rows.Count; rowIndex++)
                    {
                        for (int colIndex = 0; colIndex < cols.Count; colIndex++)
                        {
                            floor = rows[rowIndex];
                            room  = cols[colIndex];
                            UnitFwType unit_floor = unit_all.ToList().Find(m => m.CX_Axis.Equals(room) && m.CY_Axis.Equals(floor));
                            if (unit_floor != null)
                            {
                                this.model[rowIndex, colIndex] = unit_floor;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
0
 public static bool Remove(string id)
 {
     try
     {
         UnitFwService service  = new UnitFwService();
         string[]      unit     = id.Split(new string[] { Seperator.FirstChar }, StringSplitOptions.RemoveEmptyEntries);
         int           effected = 0;
         foreach (var item in unit)
         {
             if (service.DeleteUnit(item))
             {
                 effected++;
             }
         }
         return(effected > 0);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    string buildId = ConvertUtility.Trim(Request.QueryString["id"]);

                    var unitService = new UnitFwService();
                    var rows        = unitService.ListFloor(buildId);
                    var cols        = unitService.ListRoom(buildId);
                    var unitAll     = unitService.ListUnit(buildId);

                    this.Rows    = rows;
                    this.Columns = cols;
                    this.model   = new UnitFwType[rows.Count, cols.Count];

                    for (int rowIndex = 0; rowIndex < rows.Count; rowIndex++)
                    {
                        for (int colIndex = 0; colIndex < cols.Count; colIndex++)
                        {
                            string floor     = rows[rowIndex];
                            string room      = cols[colIndex];
                            var    unitFloor = unitAll.ToList().Find(m => m.CX_Axis.Equals(room) && m.CY_Axis.Equals(floor));
                            if (unitFloor != null)
                            {
                                this.model[rowIndex, colIndex] = unitFloor;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string httpMethod = Request.HttpMethod;
                string buildId    = ConvertUtility.Trim(Request.QueryString["id"]);

                if (httpMethod.Equals("get", StringComparison.OrdinalIgnoreCase))
                {
                    BuildFwService buildService = new BuildFwService();
                    this.Build = buildService.GetBuild(buildId);
                }
                else
                {
                    int    x_axis_c      = ConvertUtility.ToInt(Request.Form["x_axis"]);
                    string x_axis_t      = ConvertUtility.Trim(Request.Form["x_axis_t"]);
                    bool   x_axis_except = ConvertUtility.ToBoolean(Request.Form["x_axis_except"]);

                    int  y_axis_b      = ConvertUtility.ToInt(Request.Form["y_axis_b"]);
                    int  y_axis_e      = ConvertUtility.ToInt(Request.Form["y_axis_e"]);
                    bool y_axis_except = ConvertUtility.ToBoolean(Request.Form["y_axis_except"]);

                    int    countf      = ConvertUtility.ToInt(Request.Form["countf"]);
                    int    countt      = ConvertUtility.ToInt(Request.Form["countt"]);
                    int    countw      = ConvertUtility.ToInt(Request.Form["countw"]);
                    int    county      = ConvertUtility.ToInt(Request.Form["county"]);
                    float  area        = ConvertUtility.ToFloat(Request.Form["area"]);
                    string directionTo = ConvertUtility.Trim(Request.Form["directionTo"]);

                    if (y_axis_b <= y_axis_e)
                    {
                        UnitFwService unitService = new UnitFwService();
                        string        x_axis      = string.Empty;
                        string        y_axis      = string.Empty;
                        for (int y = y_axis_b; y <= y_axis_e; y++)
                        {
                            if (y_axis_except && y.ToString().IndexOf("4") >= 0)
                            {
                                continue;
                            }
                            for (int x = 1; x <= x_axis_c; x++)
                            {
                                y_axis = y.ToString();
                                x_axis = x.ToString();
                                if (x_axis_t.Equals("a"))
                                {
                                    int ascii = x + 64;
                                    if (x > 90)
                                    {
                                        continue;
                                    }
                                    else
                                    {
                                        System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
                                        char[] chars = encoding.GetChars(new byte[] { (byte)ascii });
                                        x_axis = chars[0].ToString();
                                    }
                                }
                                else
                                {
                                    if (x_axis_except && x.ToString().IndexOf("4") >= 0)
                                    {
                                        continue;
                                    }
                                }
                                unitService.AddUnit(buildId, x_axis, y_axis, countf, countt, countw, county, area, directionTo);
                            }
                        }

                        Response.Write("true");
                    }
                    else
                    {
                        Response.Write("false");
                    }
                    Response.End();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }