Beispiel #1
0
        public void purge_comp_from_pgt(component_p comp, string client
                                        )
        {
            if (comp.super_comp > 0
                )
            {
                return;
            }

            foreach (int i in comps_pgt[client].Keys
                     )
            {
                component_p c = comps_pgt[client][i].Find(p => p.ID == comp.ID
                                                          );

                if (c == null
                    )
                {
                }
                else
                {
                    comps_pgt[client][i].Remove(c);

                    break;
                }
            }
        }
Beispiel #2
0
        public string purge_comp(int comp, string client,
                                 int c_serv
                                 )
        {
            int sub_comps = components_p.get_sub_comps(comp).Count;

            if (sub_comps == 0
                )
            {
                component_p c = components_p.get(comp);

                c.purge();
                purge_comp_from_pgt(c, client
                                    );
                return("0" + s240 + c.super_comp);
            }

            string r = "There are sub components associated to this." + "<br>" + "<br>";

            r += get_record("Purge sub components", "Purge this & each sub component",
                            "purge_comp_subs(" + comp +
                            ");", ""
                            );
            r += get_record("Promote sub components", "Purge this, but promote each sub component",
                            "purge_comp_promote(" + comp +
                            ");", ""
                            );

            string topic = "Sub Components";

            return("2" + s240 + r + s240 + topic);
        }
Beispiel #3
0
        public string edit_comp_name2(int comp, string cur, int c_serv
                                      )
        {
            component_p comp_ = components_p.get(comp);

            comp_.revise("name", cur
                         );

            return(comp + s240 + cur);
        }
Beispiel #4
0
        public string purge_comp_subs(int comp, string client,
                                      int c_serv
                                      )
        {
            component_p c = components_p.get(comp);

            purge_comp_subs_recurs(c);

            return(c.super_comp.ToString());
        }
Beispiel #5
0
        public string edit_comp_type2(int comp, int type, int c_serv
                                      )
        {
            component_p c = components_p.get(comp);

            c.revise("comp_type", type
                     );

            type_ r = type_s.get(type);

            return(comp + s240 + r.type);
        }
Beispiel #6
0
        public string edit_comp_name(int comp, int c_serv
                                     )
        {
            component_p comp_ = components_p.get(comp);

            string cur = comp_.name;

            string method = "edit_comp_name2(" + comp +
                            ");";

            return(edit_comp_name_generic(cur, method
                                          ));
        }
Beispiel #7
0
        public void purge_comp_subs_recurs(component_p comp
                                           )
        {
            comp.purge();

            List <component_p
                  > subs = components_p.get_sub_comps(comp.ID
                                                      );

            foreach (component_p r in subs
                     )
            {
                purge_comp_subs_recurs(r);
            }
        }
Beispiel #8
0
        public string get_comp(int comp, string client,
                               int c_serv
                               )
        {
            string cur = client;

            cli_p c    = clis[cur];
            bool  edit = !true;

            if (c.group_ == 1
                )
            {
                edit = true;
            }

            component_p comp_ = components_p.get(comp
                                                 );

            string type = type_s.get(comp_.comp_type
                                     ).type;

            string r = "";

            r += get_record("Name", comp_.name, "edit_comp_name(" + comp +
                            ");", "edit_comp_name", edit
                            );

            r += get_record("Type", type, "edit_comp_type(" + comp +
                            ");", "edit_comp_type", edit
                            );
            string edit_img = "";

            if (edit
                )
            {
                edit_img = Properties.Resources.ht_edit_img_choose.Replace("//comp//", comp.ToString()
                                                                           );
            }
            string resu = Properties.Resources.ht_edit_comp.Replace("//content//", r
                                                                    )
                          .Replace("//src//", imgs.byte_to_base64(comp_.img, comp_.format
                                                                  )
                                   )
                          .Replace("//edit img//", edit_img
                                   );

            return(resu);
        }
Beispiel #9
0
        public string purge_comp_promote(int comp, string client,
                                         int c_serv
                                         )
        {
            component_p c = components_p.get(comp);

            c.purge();

            List <component_p
                  > subs = components_p.get_sub_comps(comp);

            foreach (component_p r in subs
                     )
            {
                r.revise("super_comp", c.super_comp
                         );
            }

            return(c.super_comp.ToString());
        }
Beispiel #10
0
        public string create_sub_comp(
            int comp, int c_serv
            )
        {
            string img = Properties.Resources.ht_create_sub_comp_img;
            string r   = "";

            r += get_record("Name", ni, "create_sub_comp_name();", "create_sub_comp_name"
                            );

            r += get_record("Type", ni, "create_sub_comp_type();", "create_sub_comp_type"
                            );

            r += get_record("Image", img,
                            "create_sub_comp_img();", "create_sub_comp_img"
                            );

            r += "<br><br>";

            r += get_record("Store", "Store this component", "create_sub_comp2(" + comp +
                            ");", ""
                            );

            string topic = "Create Component";

            if (comp > 0
                )
            {
                topic = "Create Sub Component for: ";

                component_p comp_ =
                    components_p.get(comp);

                topic += comp_.name;
            }

            r += s240 + topic;

            return(r);
        }
Beispiel #11
0
        public string edit_comp_img2(
            string img_stg,
            int comp,
            int c_serv
            )

        {
            img_stg_p ims = img_stgs_p.get(img_stg
                                           );
            string r = "";

            if (ims == null
                )
            {
                r += "Could not locate the image" + "<br>";
            }

            if (!r.Equals("")
                )
            {
                //2 = error
                return("2" + s240 + r);
            }
            ims.purge();

            component_p c = components_p.get(comp
                                             );

            c.revise("img", ims.img
                     );

            c.revise("format", ims.format
                     );

            return("0" + s240 + comp + s240 + imgs.byte_to_base64(ims.img, ims.format
                                                                  ));
        }
Beispiel #12
0
        public string create_sub_comp2(
            string name, int type, int super_comp, string img_stg, string client,
            int c_serv
            )
        {
            string r = "";

            name = name.Trim();

            if (name == ""
                )
            {
                r += "You must provide the <i>name</i> for this component" + "<br>";
            }

            if (type == 0
                )
            {
                r += "<i>Type</i> is required for this component" + "<br>";
            }
            if (img_stg == ""
                )
            {
                r += "<i>Image</i> is required for this component" + "<br>";
            }

            img_stg_p ims = img_stgs_p.get(img_stg
                                           );

            if (ims == null
                )
            {
                r += "Could not locate the image" + "<br>";
            }

            if (!r.Equals("")
                )
            {
                //2 = error
                return("2" + s240 + r);
            }

            ims.purge();
            string cur = DateTime.Now.Ticks.ToString();

            component_p comp = new component_p();

            comp.name = name;
            if (super_comp == 0
                )
            {
                comp.name = cur;
            }

            comp.comp_type = type;

            comp.super_comp = super_comp;

            comp.img    = ims.img;
            comp.format = ims.format;
            comp.submit();

            if (super_comp == 0
                )
            {
                comp      = components_p.get(cur);
                comp.name = name;
                comp.revise("name", name
                            );

                int i = comps_pgt[client].Count;
                comps_pgt[client][i].Add(comp
                                         );
            }

            return("0" + s240 + super_comp);
        }