Example #1
0
        /// <summary>
        /// 根据条件,修改一个数据
        /// </summary>
        /// <param name="condition">修改数据的条件</param>
        /// <param name="data1">新的数据</param>
        public void EditData(List <SearchField> condition, Dictionary <String, object> data1)
        {
            JTable tab1 = new JTable(daConnect, TableName);

            tab1.EditData(data1, condition);
            tab1.Close();
        }
Example #2
0
        /// <summary>
        /// 根据条件,修改一个实体数据
        /// </summary>
        /// <param name="condition">修改数据的条件</param>
        /// <param name="data1">新的数据</param>
        public void EditData(List <SearchField> condition, JAuthorityDetailDD data1)
        {
            JTable tab1 = new JTable(daConnect, TableName);

            tab1.EditData(data1, condition);
            tab1.Close();
        }
        /// <summary>
        /// 根据条件,修改一个实体数据
        /// </summary>
        /// <param name="condition">修改数据的条件</param>
        /// <param name="data1">新的数据</param>
        public void EditData(List <SearchField> condition, JUserActionLogDD data1)
        {
            JTable tab1 = new JTable(daConnect, TableName);

            tab1.EditData(data1, condition);
            tab1.Close();
        }
Example #4
0
        /// <summary>
        /// 功能:更新数据
        /// </summary>
        /// <param name="condition">更新数据的条件</param>
        /// <param name="newData">新数据的值</param>
        public void UpdateData(List <SearchField> condition, Dictionary <string, object> newData)
        {
            JTable tab1 = new JTable(TableName);

            tab1.EditData(newData, condition);
            tab1.Close();
        }
Example #5
0
        /// <summary>
        /// 将视图状态中的数据进行提交
        /// 1、判断是否有删除的数据,如果有,则删除
        /// 2、判断是否有新增的数据,如果有,则新增
        /// 3、剔除PARENTGUID为-1的数据
        /// </summary>
        public void Submit()
        {
            DataTable                   dt1       = this.AttachmentList;
            JTable                      tab1      = new JTable(this.TableName);
            List <SearchField>          condition = new List <SearchField>();
            Dictionary <String, object> dic1      = new Dictionary <string, object>();

            foreach (DataRow dr1 in dt1.Rows)
            {
                if (dr1["PARENTGUID"].ToString() != "-1")
                {
                    if (dr1["DataStatus"].ToString() == "deletedata")  //需要删除数据
                    {
                        //删除文件
                        if (String.IsNullOrEmpty(dr1["FILEDIR"].ToString()) == false &&
                            String.IsNullOrEmpty(dr1["ENCRYPTFILENAME"].ToString()) == false)
                        {
                            String fileName = dr1["FILEDIR"].ToString() + dr1["ENCRYPTFILENAME"].ToString();
                            fileName = Server.MapPath(fileName);
                            if (File.Exists(fileName))
                            {
                                File.Delete(fileName);
                            }
                        }

                        //删除数据库中的相关数据
                        condition.Clear();
                        condition.Add(new SearchField("GUIDID", dr1["GUIDID"].ToString()));
                        dic1.Clear();
                        dic1["DEL"] = "1";  //逻辑删除数据
                        tab1.EditData(dic1, condition);
                        //tab1.DeleteData(condition);
                    }

                    if (dr1["DataStatus"].ToString() == "newdata")  //表示新增数据
                    {
                        //将文件名改名,去掉$$符号
                        if (String.IsNullOrEmpty(dr1["FILEDIR"].ToString()) == false &&
                            String.IsNullOrEmpty(dr1["ENCRYPTFILENAME"].ToString()) == false)
                        {
                            String fileName  = dr1["FILEDIR"].ToString() + dr1["ENCRYPTFILENAME"].ToString();
                            String fileName1 = dr1["FILEDIR"].ToString() + dr1["ENCRYPTFILENAME"].ToString().Replace("$$", "");
                            fileName  = Server.MapPath(fileName);
                            fileName1 = Server.MapPath(fileName1);

                            File.Copy(fileName, fileName1);
                            File.Delete(fileName);
                        }

                        //更新数据中的数据
                        dic1.Clear();
                        dic1 = FrameLib.GetDictionaryByDataRow(dr1);
                        dic1["ENCRYPTFILENAME"] = dic1["ENCRYPTFILENAME"].ToString().Replace("$$", "");
                        dic1.Remove("DataStatus");
                        tab1.InsertData(dic1);
                    }
                }
            }
            tab1.Close();
        }
Example #6
0
        void button1_Click(object sender, EventArgs e)
        {
            JTable                      tab1      = new JTable("LINEPROFILE");
            List <SearchField>          condition = new List <SearchField>();
            Dictionary <String, object> data1     = new Dictionary <string, object>();
            int i = 1;

            String[] arr1 = "Fee1,Fee2,Fee3,Fee4,Fee5,Fee6".Split(',');
            foreach (RepeaterItem item in this.Repeater1.Items)
            {
                condition.Clear();
                condition.Add(new WebFrame.Data.SearchField("ID", i + "", WebFrame.SearchFieldType.NumericType));
                data1.Clear();
                foreach (String m in arr1)
                {
                    TextBox t1 = item.FindControl(m) as TextBox;
                    if (t1 != null)
                    {
                        data1[m] = t1.Text;
                    }
                }
                tab1.EditData(data1, condition);
                i++;
            }
            tab1.Close();
            BusinessRule.LineProfile.SetData();
            WebFrame.Util.JAjax.Alert("提示:更新数据操作成功!");
        }
Example #7
0
        /// <summary>
        /// 根据条件,修改一个实体数据
        /// </summary>
        /// <param name="condition">修改数据的条件</param>
        /// <param name="data1">新的数据</param>
        public void EditData(List <SearchField> condition, Tb_KH_Project_PersonDD data1)
        {
            JTable tab1 = new JTable(daConnect, TableName);

            tab1.EditData(data1, condition);
            this.executeResultCount = tab1.ExecuteResultCount;
            tab1.Close();
        }
        protected void ImportExcel(string FilePath, string SheetName)
        {
            JTable tab  = new JTable("NEWTRAIN");
            JTable tab1 = new JTable("NEWTRAIN");

            String FileName1 = HttpContext.Current.Server.MapPath(FilePath);

            if (File.Exists(FileName1))
            {
                DataSet                     ds1       = BusinessRule.PubCode.Util.xsldata(Server.MapPath(FilePath), SheetName);
                List <SearchField>          condition = new List <SearchField>();
                Dictionary <string, object> data      = new Dictionary <string, object>();
                if (ds1 != null && ds1.Tables[0].Rows.Count > 0)
                {
                    int      n   = ds1.Tables[0].Columns.Count;
                    JCommand cmd = new JCommand(JConnect.GetConnect());
                    cmd.CommandText = "select max(num) from NEWTRAIN";
                    int num = Convert.ToInt32(cmd.ExecuteScalar());
                    cmd.Close();
                    for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
                    {
                        condition.Clear();
                        condition.Add(new SearchField("TRAINNAME", ds1.Tables[0].Rows[i]["车次"].ToString()));
                        data.Clear();
                        data.Add("TRAINNAME", ds1.Tables[0].Rows[i]["车次"].ToString());
                        data.Add("ASTATION", ds1.Tables[0].Rows[i]["始发站"].ToString());
                        data.Add("BSTATION", ds1.Tables[0].Rows[i]["终到站"].ToString());
                        data.Add("TRAINBIGKIND", 0);
                        data.Add("TRAINTYPE", ds1.Tables[0].Rows[i]["列车类型"].ToString());
                        data.Add("MILE", ds1.Tables[0].Rows[i]["单程距离"].ToString());
                        data.Add("KXTS", ds1.Tables[0].Rows[i]["开行趟数"].ToString());
                        data.Add("CDZS", ds1.Tables[0].Rows[i]["车底组数"].ToString());
                        data.Add("YINZUO", ds1.Tables[0].Rows[i]["硬座"].ToString());
                        data.Add("RUANZUO", ds1.Tables[0].Rows[i]["软座"].ToString());
                        data.Add("OPENYINWO", ds1.Tables[0].Rows[i]["硬卧"].ToString());
                        data.Add("RUANWO", ds1.Tables[0].Rows[i]["软卧"].ToString());
                        data.Add("CANCHE", ds1.Tables[0].Rows[i]["餐车"].ToString());
                        data.Add("FADIANCHE", ds1.Tables[0].Rows[i]["发电车"].ToString());
                        data.Add("SHUYINCHE", ds1.Tables[0].Rows[i]["行李车"].ToString());
                        data.Add("YOUZHENGCHE", ds1.Tables[0].Rows[i]["邮政车"].ToString());
                        if (!tab1.HasData(condition))
                        {
                            data.Add("num", Convert.ToInt32(num) + 1);
                            tab.InsertData(data);
                            num++;
                        }
                        else
                        {
                            tab.EditData(data, condition);
                        }
                    }
                }
            }
            tab.Close();
            tab1.Close();
            WebFrame.Util.JAjax.Alert("导入完成!");
        }
        void button1_Click(object sender, EventArgs e)
        {
            if (FrameLib.CheckData(button1))
            {
                JTable    tab1 = new JTable("MYUSERNAME");
                Control[] con1 = new Control[] { num, password, UserName };
                Dictionary <String, object> data1     = JControl.GetControlValuesToDictionary(con1);
                List <SearchField>          condition = new List <SearchField>();
                condition.Add(new SearchField("UserName", this.UserName.Text));
                if (this.isAdmin.Checked)
                {
                    data1.Add("isAdmin", "1");
                }
                else
                {
                    data1.Add("isAdmin", "0");
                }
                tab1.EditData(data1, condition, true);
                tab1.Close();

                //更新角色中的相关数据
                JTable tab2 = new JTable();
                tab2.TableName = "JROLEUSERS";
                condition.Clear();
                condition.Add(new SearchField("RoleID", "001"));
                condition.Add(new SearchField("UserID", this.UserName.Text.Trim()));
                DataTable dt1 = tab2.SearchData(condition, -1, "*").Tables[0];
                if (this.isAdmin.Checked)
                {
                    if (dt1.Rows.Count == 0)
                    {
                        DataRow dr1 = dt1.NewRow();
                        dr1["num"]    = 1;
                        dr1["id"]     = WebFrame.Util.JString.GetUnique32ID();
                        dr1["userid"] = this.UserName.Text.Trim();
                        dr1["roleid"] = "001";
                        dt1.Rows.Add(dr1);
                        tab2.Update(dt1);
                    }
                }
                else
                {
                    if (dt1.Rows.Count > 0)
                    {
                        DataRow dr1 = dt1.Rows[0];
                        dr1.Delete();
                        tab2.Update(dt1);
                    }
                }
                tab2.Close();
                JAjax.AlertAndGoUrl("提示:操作成功", button1.UrlReferrer);
            }
        }
 void button1_Click(object sender, EventArgs e)
 {
     if (WebFrame.FrameLib.CheckData(this.button1))
     {
         this.TrainAlias.Text = this.TrainAlias.Text.Replace(",", ",");
         Dictionary <String, object> data1 = JControl.GetControlValuesToDictionary(con1);
         JTable             tab1           = new JTable("TRAINALIAS");
         List <SearchField> condition      = new List <SearchField>();
         condition.Add(new SearchField("TRAINNAME", Request.QueryString["TRAINNAME"]));
         tab1.EditData(data1, condition, true);
     }
 }
Example #11
0
        /// <summary>
        /// 更新票价数据
        /// </summary>
        public static void UpdatePriceData(
            int TrainType,
            int StartMile, int EndMile,
            Dictionary <String, object> data1)
        {
            JTable             tab       = new JTable("TicketPrice");
            List <SearchField> condition = new List <SearchField>();

            condition.Add(new SearchField("StartMile", StartMile + "", SearchFieldType.NumericType));
            condition.Add(new SearchField("EndMile", EndMile + "", SearchFieldType.NumericType));
            condition.Add(new SearchField("TrainType", TrainType + "", SearchFieldType.NumericType));
            tab.EditData(data1, condition);
            tab.Close();
        }
        void JButton2_Click(object sender, EventArgs e)
        {
            JTable tab1 = new JTable("COMMTRAINWEIGHTPROFILE");

            System.Collections.Generic.List <WebFrame.Data.SearchField> condition =
                new System.Collections.Generic.List <WebFrame.Data.SearchField>();
            System.Collections.Generic.Dictionary <String, object> data1 =
                new System.Collections.Generic.Dictionary <string, object>();
            int i = 0;

            String[] arr1 = "YzWeight,YwWeight,SYzWeight,SRzWeight,Rzweight,RwWeight,GRw19KWeight,GRw19TWeight,CaWeight,KdWeight".Split(',');
            foreach (RepeaterItem item in this.Repeater2.Items)
            {
                condition.Clear();
                condition.Add(new WebFrame.Data.SearchField("num", (i + 1) + "", WebFrame.SearchFieldType.NumericType));
                data1.Clear();
                foreach (String m in arr1)
                {
                    TextBox t1 = item.FindControl(m) as TextBox;
                    if (t1 != null)
                    {
                        if (t1.Text.Trim() != String.Empty)
                        {
                            data1[m] = t1.Text;
                        }
                        else
                        {
                            data1[m] = "0";
                        }
                    }
                }
                tab1.EditData(data1, condition);
                i++;
            }


            tab1.Close();
            BusinessRule.CheXianProfile.SetData();

            WebFrame.Util.JAjax.Alert("提示:更新数据操作成功!");
        }
Example #13
0
        protected void ImportExcel(string FilePath, string SheetName)
        {
            JTable tab  = new JTable("HIGHTRAINPROFILE");
            JTable tab1 = new JTable("HIGHTRAINPROFILE");

            String FileName1 = HttpContext.Current.Server.MapPath(FilePath);

            if (File.Exists(FileName1))
            {
                DataSet                     ds1       = BusinessRule.PubCode.Util.xsldata(Server.MapPath(FilePath), SheetName);
                List <SearchField>          condition = new List <SearchField>();
                Dictionary <string, object> data      = new Dictionary <string, object>();
                if (ds1 != null && ds1.Tables[0].Rows.Count > 0)
                {
                    int      n   = ds1.Tables[0].Columns.Count;
                    JCommand cmd = new JCommand(JConnect.GetConnect());
                    cmd.CommandText = "select max(id) from HIGHTRAINPROFILE";
                    int num = Convert.ToInt32(cmd.ExecuteScalar());
                    cmd.Close();
                    for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
                    {
                        condition.Clear();
                        condition.Add(new SearchField("HIGHTRAINTYPE", ds1.Tables[0].Rows[i]["动车类型"].ToString()));
                        data.Clear();
                        data.Add("HIGHTRAINTYPE", ds1.Tables[0].Rows[i]["动车类型"].ToString());
                        data.Add("MILETYPE", ds1.Tables[0].Rows[i]["动车类别"].ToString());
                        data.Add("RATE1", ds1.Tables[0].Rows[i]["一等座基本票价"].ToString());
                        data.Add("PCOUNT1", ds1.Tables[0].Rows[i]["一等座定员"].ToString());
                        data.Add("RATE2", ds1.Tables[0].Rows[i]["二等座基本票价"].ToString());
                        data.Add("PCOUNT2", ds1.Tables[0].Rows[i]["二等座定员"].ToString());
                        data.Add("RATE3", ds1.Tables[0].Rows[i]["动卧上铺基本票价"].ToString());
                        data.Add("RATE31", ds1.Tables[0].Rows[i]["动卧下铺基本票价"].ToString());
                        data.Add("PCOUNT3", ds1.Tables[0].Rows[i]["动卧定员"].ToString());
                        data.Add("RATE4", ds1.Tables[0].Rows[i]["商务座基本票价"].ToString());
                        data.Add("PCOUNT4", ds1.Tables[0].Rows[i]["商务座定员"].ToString());

                        if (!tab1.HasData(condition))
                        {
                            data.Add("id", Convert.ToInt32(num) + 1);
                            data.Add("SPEED", 0);
                            data.Add("PRICE", 0);
                            data.Add("COST1", 0);
                            data.Add("COST2", 0);
                            data.Add("COST3", 0);
                            data.Add("COST21", 0);
                            data.Add("COST22", 0);
                            data.Add("SPEED2", 0);
                            data.Add("SPEED3", 0);
                            tab.InsertData(data);
                            num++;
                        }
                        else
                        {
                            tab.EditData(data, condition);
                        }
                    }
                }
            }
            tab.Close();
            tab1.Close();
            WebFrame.Util.JAjax.Alert("导入完成!");
        }
Example #14
0
        void button1_Click(object sender, EventArgs e)
        {
            String lineid1 = this.LineID.Text.Trim();

            if (String.IsNullOrEmpty(lineid1) == false)
            {
                bool check1 = true;
                if (this.dqh.SelectedValue == String.Empty)
                {
                    check1 = false;
                }

                //更新线路站点的电气化标志
                JTable             tab1      = new JTable("LINESTATION");
                List <SearchField> condition = new List <SearchField>();
                condition.Add(new SearchField("lineid", lineid1, SearchFieldType.NumericType));
                Dictionary <string, object> data1 = new Dictionary <string, object>();
                if (check1)
                {
                    data1["dqh"] = "1";
                }
                else
                {
                    data1["dqh"] = String.Empty;
                }
                tab1.EditData(data1, condition);

                //更新起始点和终点名称
                if (this.Astation1.Text != String.Empty &&
                    this.AStation.Text != String.Empty)
                {
                    condition.Add(new SearchField("Astation", this.Astation1.Text));
                    data1.Clear();
                    data1.Add("Astation", this.AStation.Text);
                    tab1.EditData(data1, condition);

                    condition.Clear();
                    condition.Add(new SearchField("lineid", lineid1, SearchFieldType.NumericType));
                    condition.Add(new SearchField("bstation", this.Astation1.Text));
                    data1.Clear();
                    data1.Add("bstation", this.AStation.Text);
                    tab1.EditData(data1, condition);
                }


                if (this.BStation1.Text != String.Empty &&
                    this.BStation.Text != String.Empty)
                {
                    condition.Clear();
                    condition.Add(new SearchField("lineid", lineid1, SearchFieldType.NumericType));
                    condition.Add(new SearchField("BStation", this.BStation1.Text));
                    data1.Clear();
                    data1.Add("BStation", this.BStation.Text);
                    tab1.EditData(data1, condition);

                    condition.Clear();
                    condition.Add(new SearchField("lineid", lineid1, SearchFieldType.NumericType));
                    condition.Add(new SearchField("AStation", this.BStation1.Text));
                    data1.Clear();
                    data1.Add("AStation", this.BStation.Text);
                    tab1.EditData(data1, condition);
                }
                tab1.Close();
            }
        }
Example #15
0
        //更新数据
        public bool UpdateData(Dictionary <String, object> data1)
        {
            bool result = false;
            List <SearchField> condition = new List <SearchField>();
            JTable             tab1      = new JTable();
            JTable             tab2      = new JTable();
            JTable             tab3      = new JTable("LineStation");

            try
            {
                tab1.MyConnect.BeginTrans();

                //更新CHANGJIAOQYFEE表中信息
                tab1.TableName = "CHANGJIAOQYFEE";
                String lineid = String.Empty;
                if (data1["lineid"] == null ||
                    data1["lineid"].ToString() == String.Empty ||
                    data1["lineid"].ToString() == "-1")
                {
                    data1.Remove("lineid");
                    tab1.InsertData(data1);

                    tab2.TableName = "CHANGJIAOQYFEE";
                    condition.Clear();
                    condition.Add(new SearchField("linename", data1["linename"].ToString().Trim()));
                    tab2.OrderBy = "lineid desc";
                    DataRow dr1 = tab2.GetFirstDataRow(condition, "lineid");
                    if (dr1 != null)
                    {
                        lineid = dr1["lineid"].ToString().Trim();
                    }
                    tab2.Close();
                }
                else
                {
                    lineid = data1["lineid"].ToString();
                    condition.Clear();
                    condition.Add(new SearchField("lineid", data1["lineid"].ToString().Trim(), SearchFieldType.NumericType));
                    tab1.EditData(data1, condition);
                }


                //更新LineStation中的相关数据
                if (String.IsNullOrEmpty(lineid) == false)
                {
                    //线路
                    String        error     = String.Empty;
                    String        lineName  = data1["linename"].ToString();
                    List <String> arrlineID = CheckLine(lineName, out error);
                    int           fee1      = int.Parse(data1["fee1"].ToString());
                    int           fee2      = int.Parse(data1["fee2"].ToString());
                    int           fee3      = 0;

                    if (String.IsNullOrEmpty(error))
                    {
                        Dictionary <String, object> data2 = new Dictionary <string, object>();
                        data2["checkflag"] = "1";
                        JTable tab4 = new JTable("CHANGJIAOQYFEE");
                        condition.Clear();
                        condition.Add(new SearchField("lineid", lineid, SearchFieldType.NumericType));
                        tab4.EditData(data2, condition);
                        tab4.Close();

                        //线路站点
                        String   jiaolu    = data1["jiaolu"].ToString();
                        String[] arrJiaolu = jiaolu.Replace("~", "-").Replace("~", "-").Replace("-", "-").Split('-');
                        for (int i = 0; i < arrJiaolu.Length - 1; i++)
                        {
                            //调整字符中的分隔符。
                            String[] a0 = arrJiaolu[i].Trim().Replace("、", ";").Replace(",", ";").Replace(",", ";").Replace(".", ";")
                                          .Replace("(", ";").Replace(")", "").Replace("(", ";").Replace(")", "").Split(';');
                            String[] a1 = arrJiaolu[i + 1].Trim().Replace("、", ";").Replace(",", ";").Replace(",", ";").Replace(".", ";")
                                          .Replace("(", ";").Replace(")", "").Replace("(", ";").Replace(")", "").Split(';');

                            for (int j = 0; j < a0.Length; j++)
                            {
                                a0[j] = a0[j].Trim();
                                if (j > 0)
                                {
                                    if (a0[j] == "东" || a0[j] == "南" || a0[j] == "西" || a0[j] == "北")
                                    {
                                        a0[j] = a0[j - 1] + a0[j];
                                    }
                                }
                            }

                            for (int j = 0; j < a1.Length; j++)
                            {
                                a1[j] = a1[j].Trim();
                                if (j > 0)
                                {
                                    if (a1[j] == "东" || a1[j] == "南" || a1[j] == "西" || a1[j] == "北")
                                    {
                                        a1[j] = a1[j - 1] + a1[j];
                                    }
                                }
                            }

                            //提交数据更新
                            foreach (String Astation in a0)
                            {
                                foreach (String Bstation in a1)
                                {
                                    UpdateLineStation(tab3, arrlineID, Astation, Bstation, fee1, fee2, fee3);
                                }
                            }
                        }
                    }
                    else
                    {
                        JAjax.Alert(error);
                    }
                }

                //提交事务处理
                tab1.MyConnect.CommitTrans();
                result = true;
            }
            catch (Exception err)
            {
                tab1.MyConnect.RollBackTrans();
                ;
            }

            tab1.Close();
            tab2.Close();
            tab3.Close();
            return(result);
        }