Esempio n. 1
0
        /// <summary>
        /// 编辑终端信息
        /// </summary>
        public void Edit(Model.Terminal terminal, Model.Source source1)
        {
            terminal.Update();
            

            //循环更新附件
            string[] picName = source1.SourceUrl.Replace("|$|", "&").Split(new char[] { '&' });
            for (int i = 0; i < picName.Length - 1; i++)
            {
                string[] picUrl = picName[i].Replace("|#|", "|").Split(new char[] { '|' });
                source1.SourceUrl = picUrl[1];
                source1.SourceType = picUrl[0];
                Hashtable ht = new Hashtable();
                ht.Add("TerGuid", source1.TerGuid);
                ht.Add("SourceType", source1.SourceType);
                if (source1.IsExist(ht))
                {
                    source1.Update(
                        "SourceUrl='" + source1.SourceUrl + "'",
                        " and TerGuid='" + source1.TerGuid + "' and SourceType='" + source1.SourceType + "'");
                }
                else
                {
                    source1.CreateTime = DateTime.Now;
                    source1.Insert();
                }

            }

            
        }
Esempio n. 2
0
 public ActionResult Create(Memo m)
 {
     //Insert the object
     myModel.Insert(m);
     //Come back to the main page
     return(RedirectToAction("Index"));
 }
Esempio n. 3
0
        private void ModelSaveButtonInsert_Click(object sender, RoutedEventArgs e)
        {
            Model _Model = new Model();

            _Model.str_Description = ModelBezeichnungUpdateInsert.Text;

            foreach (Hersteller item in DataController.ReturnHersteller())
            {
                if (ModelHerstellerUpdateInsert.Text == item.str_Name)
                {
                    _Model.int_Manufacturer = item.int_ID;
                }
            }

            _Model.Insert();

            DataController.CreateDataLayer();

            HerstellerGrid = _Controller.FillHerstellerGrid(HerstellerGrid, DataController.ReturnHersteller());
            ModelGrid      = _Controller.FillModelGrid(ModelGrid, DataController.ReturnModels());
            ArticleGrid    = _Controller.FillArticleGrid(ArticleGrid, DataController.ReturnLiveArtikel());

            // Clear formular
            _Controller.ClearGrid(ModelInsertGrid, true);

            ModelNothingSelectedInsert.Content    = "Datensatz erfolgreich erstellt!";
            ModelNothingSelectedInsert.Foreground = Brushes.Green;
            ModelNothingSelectedInsert.Visibility = Visibility.Visible;
            ModelSaveButtonInsert.IsEnabled       = false;
        }
Esempio n. 4
0
 /* ----------------------------------------------------------------- */
 ///
 /// SetCommands
 ///
 /// <summary>
 /// Sets commands of the MainWindow.
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 private void SetCommands()
 {
     Open                        = IsDrop();
     InsertOrMove                = IsDragMove();
     Recent.Open                 = IsLink();
     Ribbon.Open.Command         = Any(() => PostOpen(e => Model.Open(e)));
     Ribbon.Close.Command        = Close();
     Ribbon.Save.Command         = IsOpen(() => Post(() => Model.Overwrite()));
     Ribbon.SaveAs.Command       = IsOpen(() => PostSave(e => Model.Save(e)));
     Ribbon.Preview.Command      = IsItem(() => PostPreview());
     Ribbon.Select.Command       = IsOpen(() => Send(() => Model.Select()));
     Ribbon.SelectAll.Command    = IsOpen(() => Send(() => Model.Select(true)));
     Ribbon.SelectFlip.Command   = IsOpen(() => Send(() => Model.Flip()));
     Ribbon.SelectClear.Command  = IsOpen(() => Send(() => Model.Select(false)));
     Ribbon.Insert.Command       = IsItem(() => PostInsert(e => Model.Insert(e)));
     Ribbon.InsertFront.Command  = IsOpen(() => PostInsert(e => Model.Insert(0, e)));
     Ribbon.InsertBack.Command   = IsOpen(() => PostInsert(e => Model.Insert(int.MaxValue, e)));
     Ribbon.InsertOthers.Command = IsOpen(() => PostInsert());
     Ribbon.Extract.Command      = IsItem(() => PostSave(e => Model.Extract(e)));
     Ribbon.Remove.Command       = IsItem(() => Send(() => Model.Remove()));
     Ribbon.RemoveOthers.Command = IsOpen(() => PostRemove());
     Ribbon.MovePrevious.Command = IsItem(() => Send(() => Model.Move(-1)));
     Ribbon.MoveNext.Command     = IsItem(() => Send(() => Model.Move(1)));
     Ribbon.RotateLeft.Command   = IsItem(() => Send(() => Model.Rotate(-90)));
     Ribbon.RotateRight.Command  = IsItem(() => Send(() => Model.Rotate(90)));
     Ribbon.Metadata.Command     = IsOpen(() => PostMetadata());
     Ribbon.Encryption.Command   = IsOpen(() => PostEncryption());
     Ribbon.Refresh.Command      = IsOpen(() => Send(() => Model.Refresh()));
     Ribbon.Undo.Command         = IsUndo();
     Ribbon.Redo.Command         = IsRedo();
     Ribbon.ZoomIn.Command       = Any(() => Send(() => Model.Zoom(1)));
     Ribbon.ZoomOut.Command      = Any(() => Send(() => Model.Zoom(-1)));
     Ribbon.Settings.Command     = Any(() => PostSettings());
     Ribbon.Exit.Command         = Any(() => Send <CloseMessage>());
 }
Esempio n. 5
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            bool result = db.Insert("insert into Blog(Category,Title,Details1,Details,Author,[Year])values('" + txtCategory.SelectedValue.ToString() + "','" + tbTitle.Text + "','" + txtSummary.Text + "','" + tbDetails.Text + "','" + tbAuthor.Text + "','" + System.DateTime.Now.ToString("dd-MMM-yyyy") + "')");
            if (result == true)
            {
                gridDataBind();

                txtCategory.SelectedValue = "0";
                tbTitle.Text    = "";
                txtSummary.Text = "";
                tbDetails.Text  = "";

                lblalert.Text       = "Blog Added Successfully";
                alertdenger.Visible = false;
                alert.Visible       = true;
            }
            else
            {
                lblalert.Text       = "Some Error occured in Data Try Again.";
                alertdenger.Visible = true;
                alert.Visible       = false;
            }
        }
        catch (Exception ex)
        {
            lblalertdenger.Text = ex.Message;
            alertdenger.Visible = true;
            alert.Visible       = false;
        }
    }
Esempio n. 6
0
        protected void lnkSend_Click(object sender, EventArgs e)
        {
            Model m = new Model();

            m.BrandId   = int.Parse(drpMarka.SelectedValue);
            m.ModelText = txtModel.Text;
            m.Insert();
            Response.Redirect("../../index.aspx"); // TODO: Listeye çevir
        }
Esempio n. 7
0
        public void InsertPoint(CVPoint point, int segmentIndex)
        {
            Vector3 startPos = points[segmentIndex].Position;
            Vector3 endPos   = points[segmentIndex + 1].Position;

            Model.Insert(segmentIndex + 1, point.Model);
            points.Insert(segmentIndex + 1, point);

            segments[segmentIndex].SetPositions(startPos, point.Position); // modify segment like part 1
            CreateSegment(point.Position, endPos, segmentIndex + 1);       // create segment like part 2
        }
Esempio n. 8
0
        private void Vlozit_Click(object sender, RoutedEventArgs e)
        {
            Model.IdUlice = IdUlice;
            var result = Model.Insert();

            FormularGenerator.GenerujSpravu(result, Model.ErrorMessage);
            if (result)
            {
                DataContext = null;
                DataContext = new SStlp();
            }
        }
Esempio n. 9
0
        private void Vlozit_Click(object sender, RoutedEventArgs e)
        {
            Model.Cislo = CisloStlpu;
            var result = Model.Insert();

            FormularGenerator.GenerujSpravu(result, Model.ErrorMessage);
            if (result)
            {
                DataContext    = null;
                DataContext    = new SInfo();
                Obrazok.Source = null;
            }
        }
Esempio n. 10
0
        public override T Insert(T item)
        {
            var expando = SetDataForDocument(item);

            expando = Model.Insert(expando);
            if (Model.PrimaryKeyMapping.IsAutoIncementing)
            {
                var newId = Model.GetPrimaryKey(expando);
                this.SetPrimaryKey(item, newId);
                // update document body of autoinc Pk value (insert and update should go within transaction, wait for Biggy transactions)
                Update(item);
            }
            return(item);
        }
Esempio n. 11
0
        void ScenarioViewModel_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
                for (int i = e.NewStartingIndex; i < e.NewStartingIndex + e.NewItems.Count; i++)
                {
                    this[i].OwnerScenario = this;
                    Model.Insert(i, this[i].Model);
                }
                break;

            case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
                for (int i = e.NewStartingIndex; i < e.NewStartingIndex + e.NewItems.Count; i++)
                {
                    this[i].OwnerScenario = this;
                    Model[i] = this[i].Model;
                }
                break;

            case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
                foreach (AtomViewModel atom in e.OldItems)
                {
                    atom.OwnerScenario = null;
                    Model.RemoveAt(e.OldStartingIndex);

                    if (OwnerDocument != null)
                    {
                        OwnerDocument.ClearLinks(atom);
                    }
                }

                IsComplex = Items.Any(atom => atom.Model.Type == AtomTypes.Marker);
                break;

            case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
                Model.Clear();
                foreach (AtomViewModel atom in this)
                {
                    atom.OwnerScenario = this;
                    Model.Add(atom.Model);
                }

                IsComplex = Items.Any(atom => atom.Model.Type == AtomTypes.Marker);
                break;
            }

            UpdateCommands();
        }
Esempio n. 12
0
        public void Edit(Model.AcceptForm acceptform, Model.AD ad, Model.Client client, Model.Publish publish)
        {
            //客户信息插入或更新
            Hashtable hs = new Hashtable();
            hs.Add("ClientName", client.ClientName);
            if (client.IsExist(hs))
            {
                client.Update(
                    "ClientName='" + client.ClientName + "',Tel='" + client.Tel + "',Mobile='" + client.Mobile + "',Operator='" + client.Operator + "',AgencyCompany='" + client.AgencyCompany + "'",
                    " and ClientName ='" + client.ClientName + "'");
                HD.Model.Client newClient = HD.Model.Client.Instance.GetModelById(hs);
                acceptform.ClientGuid = newClient.ClientPGuid;
            }
            else
            {
                client.ClientPostTime = DateTime.Now;
                client.ClientPGuid = Public.GetGuID;
                client.Insert();
                acceptform.ClientGuid = client.ClientPGuid;
            }

            //广告插入
            ad.Update();

            //先删除原来的发布形式,再循环插入发布形式
            //string strSql = " and ADGuid='" + publish.ADGuid + "'";
            hs.Clear();
            hs.Add("ADGuid", ad.ADPGuid);
            publish.Delete(hs);
            //string StrSql = "Select * From " + DbConfig.Prefix + "Admin Where AdminName=@AdminName And AdminPass=@AdminPass And IsLock=1";
            //IDataParameter[] Param = new IDataParameter[] { 
            //    DbHelper.MakeParam("@AdminName",AdminName),
            //    DbHelper.MakeParam("@AdminPass",AdminPass)
            //};
            string[] pubTypeName = publish.PublishType.Split(',');
            string[] pubTypeNu = publish.PublishQuantity.Split(',');
            for (int i = 0; i < pubTypeName.Length; i++)
            {
                publish.ADGuid = ad.ADPGuid;
                publish.PublishType = pubTypeName[i];
                publish.PublishQuantity = pubTypeNu[i];

                publish.Insert();
            }

            //更新受理单信息
            acceptform.Update(acceptform);

        }
Esempio n. 13
0
        public void Add(Model.Terminal terminal, Model.Source source)
        {
            terminal.Insert();
            

            //循环插入附件
            string[] picName = source.SourceUrl.Replace("|$|", "&").Split(new char[] { '&' });
            for (int i = 0; i < picName.Length - 1; i++)
            {
                string[] picUrl = picName[i].Replace("|#|", "|").Split(new char[] { '|' });
                source.SourceUrl = picUrl[1];
                source.SourceType = picUrl[0];
                source.Insert();
            }
        }
Esempio n. 14
0
        public ActionResult Insert()
        {
            var           allQuestions = Database.Get("SELECT * FROM [question]", 1);
            var           allAnswers   = Database.Get("SELECT * FROM [answer]", 1);
            List <string> allNouns     = Database.Get("SELECT * FROM [noun]", 1);
            List <string> allVerbs     = Database.Get("SELECT * FROM [verb]", 1);

            var answer   = Request.Form["answer"];
            var question = Request.Form["question"];


            Model.Insert(allAnswers, answer, "answer", "answer");

            Model.InsertQuestion(answer, allQuestions, allNouns, allVerbs, question, "question", "question");
            return(RedirectToAction("About"));
        }
Esempio n. 15
0
        public override T Insert(T item)
        {
            var expando = SetDataForDocument(item);

            expando = Model.Insert(expando);
            var pkMap = Model.TableMapping.PrimaryKeyMapping.Single(); //TODO: compound Pk not supported

            if (pkMap.IsAutoIncementing)
            {
                var newId = Model.GetPropertyValue(expando, pkMap.PropertyName);
                this.Model.SetPropertyValue(item, pkMap.PropertyName, newId);
                // update document body of autoinc Pk value (insert and update should go within transaction, wait for Biggy transactions)
                Update(item);
            }
            return(item);
        }
Esempio n. 16
0
        public void Add(Model.Repair repair, Model.Reply reply)
        {
            string guid = repair.Guid;
            repair.Update();

            Hashtable hs = new Hashtable();
            hs.Add("RepairGuid", guid);
            if (reply.IsExist(hs))
            {
                reply.Update(
                    "ReplyContent='" + reply.ReplyContent + "',ReplyName='" + reply.ReplyName + "',ReplyRepairTime='" + reply.ReplyRepairTime + "'",
                    " and RepairGuid='" + guid + "'");
            }
            else
            {
                reply.Insert();
            }
        }
Esempio n. 17
0
        //Butonul de insert apeleaza functia din obiect ce implementeaza Insertul, comunicand parametrii introdusi
        private void buttonInsert_Click(object sender, EventArgs e)
        {
            M.IDModel   = textBoxIDModel.Text;
            M.NumeModel = textBoxNumeModel.Text;

            SqlConnection conn    = new SqlConnection(myconnstring);
            DataSet       idmarca = new DataSet();

            try
            {
                //Descifram la ce marca se refera comboBox-ul
                string     sql = "SELECT IDMarca FROM Marca WHERE Nume=@NumeMarca";
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@NumeMarca", comboBoxMarca.Text);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                conn.Open();
                adapter.Fill(idmarca);
            }
            catch
            {
            }
            finally
            {
                conn.Close();
            }
            M.Marca = idmarca.Tables[0].Rows[0]["IDMarca"].ToString();

            bool succes = M.Insert(M);

            if (succes)
            {
                MessageBox.Show("Model Inserat cu Succes!");
                DataTable dt = M.Select();
                dataGridViewModel.DataSource = dt;
            }
            else
            {
                MessageBox.Show("Operatiunea a esuat!");
            }
        }
Esempio n. 18
0
        public void Add(Model.Application appli,Model.SCW scw, Model.Source source, Model.BulkFreight bulk)
        {
            appli.Insert();
            if (appli.IO==1)
            {
                scw.Insert();
            }

            //循环插入附件
            string[] picName = source.SourceUrl.Replace("|$|", "&").Split(new char[] {'&'});
            for (int i = 0; i < picName.Length - 1; i++)
            {
                string[] picUrl = picName[i].Replace("|#|", "|").Split(new char[] { '|' });
                source.SourceUrl = picUrl[1];
                source.SourceType = picUrl[0];
                source.Insert();
            }

            //循环插入散装货物列表
            string[] BfGoodsName = bulk.BfGoodsName.Split(',');
            string[] BfGoodsGroup = bulk.BfGoodsGroup.Split(',');
            string[] Class = bulk.Class.Split(',');
            string[] DangerousNo = bulk.DangerousNo.Split(',');
            string[] BfTotalWeight = bulk.BfTotalWeight.Split(',');
            string[] DischargingPort = bulk.DischargingPort.Split(',');
            string[] Position = bulk.Position.Split(',');
            string[] Remark = bulk.Remark.Split(',');
            for (int i = 0; i < BfGoodsName.Length; i++)
            {
                bulk.BfGoodsName = BfGoodsName[i];
                bulk.BfGoodsGroup = BfGoodsGroup[i];
                bulk.Class = Class[i];
                bulk.DangerousNo = DangerousNo[i];
                bulk.BfTotalWeight = BfTotalWeight[i];
                bulk.DischargingPort = DischargingPort[i];
                bulk.Position = Position[i];
                bulk.Remark = Remark[i];
                bulk.Insert();
            }
        }
Esempio n. 19
0
        public void Add(Model.AcceptForm acceptform, Model.AD ad, Model.Publish publish)
        {

            //广告插入
            ad.Insert();

            //循环插入发布形式
            string[] pubTypeName = publish.PublishType.Split(',');
            string[] pubTypeNu = publish.PublishQuantity.Split(',');
            for (int i = 0; i < pubTypeName.Length; i++)
			{
                publish.ADGuid = ad.ADPGuid;
                publish.PublishType = pubTypeName[i];
                publish.PublishQuantity = pubTypeNu[i];

                publish.Insert();
			}

            //插入受理单信息
            acceptform.Insert();

        }
Esempio n. 20
0
 public void Insert(int index, MenuItemBase item)
 {
     Model.Insert(index, item);
 }
Esempio n. 21
0
        public void Process()
        {
            string primary_key = "ID";

            foreach (PropertyInfo prop in Dataset.GetProperties())
            {
                if (prop.GetCustomAttribute <PrimaryKey>() != null)
                {
                    primary_key = prop.Name;
                    break;
                }
            }

            if (this._POST.ContainsKey("_METHOD"))
            {
                this.HTTPMethod = _POST["_METHOD"];
                _POST.Remove("_METHOD");
            }

            if (this._POST.ContainsKey("_REDIRECT"))
            {
                this.Location = _POST["_REDIRECT"];
                _POST.Remove("_REDIRECT");
            }

            Table table;
            int   UID   = 0;
            int   colID = 0;

            if (this._POST != null)
            {
                if (this.HTTPMethod != Constants.METHOD_PUT && this.HTTPMethod != Constants.METHOD_PATCH && HTTPMethod != Constants.METHOD_DELETE)
                {
                    UID = Sessions.sessions.Where(x => x.Value.Item2 == Headers.Session)
                          .Select(x => x.Key)
                          .Cast <int>()
                          .First();

                    if (UID <= 0)
                    {
                        colID = 0;
                        //fix this shit
                        try
                        {
                            if (this.HTTPMethod == Constants.METHOD_GET && this._GET["1"] != "all" &&
                                this._GET["1"] != "info")
                            {
                                colID = Convert.ToInt16(this._GET["1"]);
                            }
                            else if (this.HTTPMethod != Constants.METHOD_GET)
                            {
                                colID = Convert.ToInt16(this._POST["ID"]);
                            }
                        }
                        catch (Exception e)
                        {
                        }
                    }
                    else
                    {
                        colID = UID;
                    }
                }

                Model model = DB.GetModel(this.Dataset.Name);

                if (this.HTTPMethod == Constants.METHOD_PATCH)
                {
                    table = model.Select("*").AddFieldToFilter(primary_key, Tuple.Create <string, Expression>("eq", new Expression(_POST["ROW_ID"]))).Load();
                    if (((DataSet[])typeof(Table).GetMethod("ToDataSet").MakeGenericMethod(this.Dataset).Invoke(table, Type.EmptyTypes)).Length > 0)
                    {
                        model = model.Update();
                        foreach (KeyValuePair <string, string> kv in this._POST)
                        {
                            if (kv.Key == "ROW_ID")
                            {
                                continue;
                            }

                            KeyValuePair <string, string> kv2 = new KeyValuePair <string, string>(kv.Key, kv.Value.Replace("+", " "));
                            model = model.AddKeyValueToUpdate(kv2);
                        }

                        model.AddFieldToFilter(primary_key, Tuple.Create <string, Expression>("eq", new Expression(_POST["ROW_ID"]))).Load();

                        this.ContentType = Constants.CONTENT_JSON;
                        this.response    = Constants.STATUS_TRUE;
                    }
                }
                else if (this.HTTPMethod == Constants.METHOD_PUT)
                {
                    Model insertModel = model.Insert();

                    foreach (KeyValuePair <string, string> kv in this._POST)
                    {
                        KeyValuePair <string, string> kv2 = new KeyValuePair <string, string>(kv.Key, kv.Value.Replace("+", " "));
                        insertModel.AddDataToInsert(kv2);
                    }

                    insertModel.Load();

                    table = model.Select("*").AddFieldToFilter(primary_key, Tuple.Create <string, Expression>("eq", new Expression("LAST_INSERT_ID()", false))).Load();

                    dynamic[] result = ((dynamic[])typeof(Table).GetMethod("ToDataSet").MakeGenericMethod(this.Dataset).Invoke(table, Type.EmptyTypes));

                    this.ContentType = Constants.CONTENT_JSON;
                    this.response    = result.First().ToJSON();
                }
                else if (this.HTTPMethod == Constants.METHOD_DELETE)
                {
                    model.Delete().AddFieldToFilter(primary_key, Tuple.Create <string, Expression>("eq", new Expression(_POST["ROW_ID"]))).Load();

                    this.ContentType = Constants.CONTENT_JSON;
                    this.response    = Constants.STATUS_TRUE;
                }
                else if (this.HTTPMethod == Constants.METHOD_GET)
                {
                    model = DB.GetModel(this.Dataset.Name);
                    if (this._GET["1"] == "all")
                    {
                        int[] limit = this._GET.Count >= 3 ? new int[] { Convert.ToInt16(this._GET["2"]), Convert.ToInt16(this._GET["3"]) } : null;


                        model = model.Select("*");
                        if (limit != null)
                        {
                            model = model.SetLimit(limit[0], limit[1]);
                        }

                        table = model.Load();

                        dynamic[] result = ((dynamic[])typeof(Table).GetMethod("ToDataSet").MakeGenericMethod(this.Dataset).Invoke(table, Type.EmptyTypes));

                        this.ContentType = Constants.CONTENT_JSON;
                        this.response    = "[";

                        result.ToList <dynamic>().ForEach(x => this.response += x.ToJSON() + ",");

                        this.response = this.response.Remove(this.response.Length - 1);

                        this.response += "]";

                        if (result.Length <= 0)
                        {
                            this.response = Constants.STATUS_FALSE;
                        }
                    }
                    else if (int.TryParse(this._GET["1"], out colID))
                    {
                        //colID = Convert.ToInt16(this._GET["1"]);

                        table = model.Select("*").AddFieldToFilter(primary_key, Tuple.Create <string, Expression>("eq", new Expression(colID.ToString()))).Load();
                        dynamic[] result = ((dynamic[])typeof(Table).GetMethod("ToDataSet").MakeGenericMethod(this.Dataset).Invoke(table, Type.EmptyTypes));

                        this.ContentType = Constants.CONTENT_JSON;

                        if (result.Length > 0)
                        {
                            this.response = result.First().ToJSON();
                        }
                        else
                        {
                            this.response = Constants.STATUS_FALSE;
                        }
                    }
                    else if (this._GET["1"].Contains("info"))
                    {
                        table = model.Select("COUNT(*) as `records`").Load();

                        Dictionary <string, string> result = table.ToDict();

                        if (result.Count > 0)
                        {
                            this.response = result.ToJSON();
                        }
                    }
                }
            }
        }
Esempio n. 22
0
 /* ----------------------------------------------------------------- */
 ///
 /// PostInsert
 ///
 /// <summary>
 /// Posts the message to show a dialog of the InsertWindow
 /// class.
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 private void PostInsert() => Post(new InsertViewModel(
                                       (i, v) => Post(() => Model.Insert(i + 1, v.Select(e => e.FullName))),
                                       Data.Images.Selection.First, Data.Count.Value, Data.IO, Context
                                       ));
Esempio n. 23
0
        public void Edit(Model.Application appli,Model.SCW scw, Model.Source source1, Model.BulkFreight bulk, string bulkId)
        {
            appli.Update();
            if (appli.IO == 1)
            {
                scw.Update();
            }

            //循环更新附件
            string[] picName = source1.SourceUrl.Replace("|$|", "&").Split(new char[] { '&' });
            for (int i = 0; i < picName.Length - 1; i++)
            {
                string[] picUrl = picName[i].Replace("|#|", "|").Split(new char[] { '|' });
                source1.SourceUrl = picUrl[1];
                source1.SourceType = picUrl[0];
                Hashtable ht = new Hashtable();
                ht.Add("AppGuid", source1.AppGuid);
                ht.Add("SourceType", source1.SourceType);
                if (source1.IsExist(ht))
                {
                    source1.Update(
                        "SourceUrl='" + source1.SourceUrl + "'",
                        " and AppGuid='" + source1.AppGuid + "' and SourceType='" + source1.SourceType + "'");
                }
                else
                {
                    source1.CreateTime = DateTime.Now;
                    source1.Insert();
                }

            }

            //循环插入散装货物列表
            string[] BulkId = bulkId.Split(',');
            string[] BfGoodsName = bulk.BfGoodsName.Split(',');
            string[] BfGoodsGroup = bulk.BfGoodsGroup.Split(',');
            string[] Class = bulk.Class.Split(',');
            string[] DangerousNo = bulk.DangerousNo.Split(',');
            string[] BfTotalWeight = bulk.BfTotalWeight.Split(',');
            string[] DischargingPort = bulk.DischargingPort.Split(',');
            string[] Position = bulk.Position.Split(',');
            string[] Remark = bulk.Remark.Split(',');
            for (int i = 0; i < BfGoodsName.Length; i++)
            {
                bulk.BfGoodsName = BfGoodsName[i];
                bulk.BfGoodsGroup = BfGoodsGroup[i];
                bulk.Class = Class[i];
                bulk.DangerousNo = DangerousNo[i];
                bulk.BfTotalWeight = BfTotalWeight[i];
                bulk.DischargingPort = DischargingPort[i];
                bulk.Position = Position[i];
                bulk.Remark = Remark[i];
                bulk.Id = Convert.ToInt32(BulkId[i]);
                bulk.Update();
            }
        }